фикс
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 = [ SCOPES = [
'openid', 'openid',
'fullname', 'fullname',
# 'email', 'email',
# 'birthdate', 'birthdate',
# 'gender', 'gender',
# 'snils', 'snils',
# 'id_doc', 'id_doc',
# 'mobile', 'mobile',
] ]

View File

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