Временный обход авторизации
All checks were successful
Build And Push / publish (push) Successful in 1m59s

This commit is contained in:
2025-09-30 18:05:17 +03:00
parent c3fcd2021d
commit 87eb228210
2 changed files with 16 additions and 1117 deletions

View File

@ -4,8 +4,6 @@ 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
@ -27,22 +25,24 @@ async def login():
@router.post('/callback') @router.post('/callback')
async def callback(code: str): async def callback(code: str):
token = None # Commented for development purposes
for i in range(3): #
try: # token = None
token = await c.esia_api.access_token(code) # for i in range(3):
break # try:
except Exception: # token = await c.esia_api.access_token(code)
logger.warning( # break
'Error occurred while accessing ESI API. Retrying...' # except Exception:
) # logger.warning(
if i == 2: # 'Error occurred while accessing ESI API. Retrying...'
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)

File diff suppressed because it is too large Load Diff