Fix login after session revoke (#3013)

This commit is contained in:
Alexander Zinchuk 2023-04-19 04:08:49 +02:00
parent 6c9fee5499
commit cc9a7efbf5
3 changed files with 2 additions and 6 deletions

View File

@ -381,7 +381,7 @@ async function handleTerminatedSession() {
id: new GramJs.InputUserSelf(),
}), undefined, true);
} catch (err: any) {
if (err.message === 'AUTH_KEY_UNREGISTERED') {
if (err.message === 'AUTH_KEY_UNREGISTERED' || err.message === 'SESSION_REVOKED') {
onUpdate({
'@type': 'updateConnectionState',
connectionState: 'connectionStateBroken',

View File

@ -62,10 +62,6 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
break;
case 'error': {
if (update.error.message === 'SESSION_REVOKED') {
actions.signOut({ forceInitApi: true });
}
Object.values(global.byTabId).forEach(({ id: tabId }) => {
const paymentShippingError = getShippingError(update.error);
if (paymentShippingError) {

View File

@ -450,7 +450,7 @@ class MTProtoSender {
} catch (e) {
// `RPCError` errors except for 'AUTH_KEY_UNREGISTERED' should be handled by the client
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
this._handleBadAuthKey(true);
}