Fix login after session revoke (#3013)
This commit is contained in:
parent
6c9fee5499
commit
cc9a7efbf5
@ -381,7 +381,7 @@ async function handleTerminatedSession() {
|
|||||||
id: new GramJs.InputUserSelf(),
|
id: new GramJs.InputUserSelf(),
|
||||||
}), undefined, true);
|
}), undefined, true);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err.message === 'AUTH_KEY_UNREGISTERED') {
|
if (err.message === 'AUTH_KEY_UNREGISTERED' || err.message === 'SESSION_REVOKED') {
|
||||||
onUpdate({
|
onUpdate({
|
||||||
'@type': 'updateConnectionState',
|
'@type': 'updateConnectionState',
|
||||||
connectionState: 'connectionStateBroken',
|
connectionState: 'connectionStateBroken',
|
||||||
|
|||||||
@ -62,10 +62,6 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'error': {
|
case 'error': {
|
||||||
if (update.error.message === 'SESSION_REVOKED') {
|
|
||||||
actions.signOut({ forceInitApi: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.values(global.byTabId).forEach(({ id: tabId }) => {
|
Object.values(global.byTabId).forEach(({ id: tabId }) => {
|
||||||
const paymentShippingError = getShippingError(update.error);
|
const paymentShippingError = getShippingError(update.error);
|
||||||
if (paymentShippingError) {
|
if (paymentShippingError) {
|
||||||
|
|||||||
@ -450,7 +450,7 @@ class MTProtoSender {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// `RPCError` errors except for 'AUTH_KEY_UNREGISTERED' should be handled by the client
|
// `RPCError` errors except for 'AUTH_KEY_UNREGISTERED' should be handled by the client
|
||||||
if (e instanceof RPCError) {
|
if (e instanceof RPCError) {
|
||||||
if (e.message === 'AUTH_KEY_UNREGISTERED') {
|
if (e.message === 'AUTH_KEY_UNREGISTERED' || e.message === 'SESSION_REVOKED') {
|
||||||
// 'AUTH_KEY_UNREGISTERED' for the main sender is thrown when unauthorized and should be ignored
|
// 'AUTH_KEY_UNREGISTERED' for the main sender is thrown when unauthorized and should be ignored
|
||||||
this._handleBadAuthKey(true);
|
this._handleBadAuthKey(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user