Временный обход авторизации
All checks were successful
Build And Push / publish (push) Successful in 1m59s
All checks were successful
Build And Push / publish (push) Successful in 1m59s
This commit is contained in:
@ -4,8 +4,6 @@ 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
|
||||
@ -27,22 +25,24 @@ async def login():
|
||||
|
||||
@router.post('/callback')
|
||||
async def callback(code: str):
|
||||
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
|
||||
# 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
|
||||
|
||||
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)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user