фикс
All checks were successful
Build And Push / publish (push) Successful in 2m1s

This commit is contained in:
2025-09-30 18:14:12 +03:00
parent 87eb228210
commit 1a7bd7120a
2 changed files with 22 additions and 22 deletions

View File

@ -1,10 +1,10 @@
SCOPES = [
'openid',
'fullname',
# 'email',
# 'birthdate',
# 'gender',
# 'snils',
# 'id_doc',
# 'mobile',
'email',
'birthdate',
'gender',
'snils',
'id_doc',
'mobile',
]

View File

@ -4,6 +4,8 @@ from logging import getLogger
from fastapi import APIRouter
from apps.esia.sign import get_url
from clients import clients as c
from shared import exceptions as e
from shared.redis import client as cache
from . import schema as s
@ -25,24 +27,22 @@ async def login():
@router.post('/callback')
async def callback(code: str):
# Commented for development purposes
#
# token = None
# for i in range(3):
# try:
# token = await c.esia_api.access_token(code)
# break
# except Exception:
# logger.warning(
# 'Error occurred while accessing ESI API. Retrying...'
# )
# if i == 2:
# raise
token = None
for i in range(3):
try:
token = await c.esia_api.access_token(code)
break
except Exception:
logger.warning(
'Error occurred while accessing ESI API. Retrying...'
)
if i == 2:
raise
# if token is None:
# raise e.BadRequestException
if token is None:
raise e.BadRequestException
# await c.esia_api.get_user_info(token.access_token, token.id_token)
await c.esia_api.get_user_info(token.access_token, token.id_token)
access_token = secrets.token_urlsafe(32)
cache.set(access_token, access_token)