Skip to content
This repository was archived by the owner on Dec 3, 2022. It is now read-only.

Commit 5486920

Browse files
committed
return Telegram auth state along with token
Signed-off-by: dmig <[email protected]>
1 parent a6c893c commit 5486920

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backend/handlers/vkauth.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _final_stage(self, code):
7171
'access_token': auth['access_token']
7272
} if user else {}
7373

74-
res = rpc_call('set_vk_user', user)
74+
rpc_call('set_vk_user', user)
7575

7676
token = jwt_auth.create_token({
7777
'id': auth['user_id'],
@@ -80,7 +80,10 @@ def _final_stage(self, code):
8080

8181
self.logger.info('Issued JWT: %s', token)
8282

83-
return {'token': 'Bearer ' + token.decode("utf-8")}
83+
return {
84+
'token': 'Bearer ' + token.decode("utf-8"),
85+
'tgauth': user.get('id') and rpc_call('is_tg_authorized', user['id'])
86+
}
8487
except exceptions.HTTPError as e:
8588
self.logger.info('Error authorizing user on VK: %s', e)
8689
if e.response.status_code == 401:

0 commit comments

Comments
 (0)