♻️ Simplified Authentication-code
This commit is contained in:
+5
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user