♻️ Simplified Authentication-code

This commit is contained in:
Mawoka
2022-12-17 16:10:32 +01:00
parent d044745d62
commit bb848adca8
4 changed files with 54 additions and 32 deletions
+5 -1
View File
@@ -44,7 +44,11 @@ class OAuth2PasswordBearerWithCookie(OAuth2):
async def __call__(self, request: Request) -> Optional[str]:
authorization: str = request.cookies.get("access_token") # changed to accept access token from httpOnly Cookie
if authorization is None:
try:
authorization = request.state.access_token
except AttributeError:
pass
scheme, param = get_authorization_scheme_param(authorization)
if not authorization or scheme.lower() != "bearer":
if self.auto_error: