Фикс авторизации ЕСИА Макс
All checks were successful
Build And Push / publish (push) Successful in 3m50s
All checks were successful
Build And Push / publish (push) Successful in 3m50s
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "HospitalAssistantBackend"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
description = "Backend for Hospital Assistant"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13,<3.14"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
from datetime import UTC, datetime
|
||||
from logging import getLogger
|
||||
from typing import Any
|
||||
from typing import Any, Literal
|
||||
|
||||
import jwt
|
||||
from fastapi import status as st
|
||||
@ -36,10 +36,14 @@ class ESIA_API(AsyncClient):
|
||||
|
||||
return params
|
||||
|
||||
async def access_token(self, code: str):
|
||||
async def access_token(
|
||||
self, code: str, platform: Literal['max', 'app'] = 'app'
|
||||
):
|
||||
params = {
|
||||
'grant_type': 'authorization_code',
|
||||
'redirect_uri': settings.ESIA_REDIRECT_URI,
|
||||
'redirect_uri': settings.ESIA_REDIRECT_URI
|
||||
if platform == 'app'
|
||||
else settings.ESIA_MAX_REDIRECT_URI,
|
||||
'code': code,
|
||||
}
|
||||
signed_params = await self.sign_request(params)
|
||||
@ -49,6 +53,7 @@ class ESIA_API(AsyncClient):
|
||||
case st.HTTP_200_OK:
|
||||
return s.AccessTokenModel.model_validate(res.json())
|
||||
case st.HTTP_400_BAD_REQUEST:
|
||||
self.logger.warning(res.json())
|
||||
return None
|
||||
|
||||
case _:
|
||||
|
||||
Reference in New Issue
Block a user