Skip to content

Commit 973fc10

Browse files
committed
Get Authorization from headers before reading from cookies
1 parent 3d8c544 commit 973fc10

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/fastapi_oauth2/middleware.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ def __init__(self, config: OAuth2Config) -> None:
8585
Auth.register_client(client)
8686

8787
async def authenticate(self, request: Request) -> Optional[Tuple["Auth", "User"]]:
88-
authorization = request.cookies.get("Authorization")
88+
authorization = request.headers.get(
89+
"Authorization",
90+
request.cookies.get("Authorization"),
91+
)
8992
scheme, param = get_authorization_scheme_param(authorization)
9093

9194
if not scheme or not param:

0 commit comments

Comments
 (0)