File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414import httpx
1515import jwt
1616import requests
17+ from fastapi import Cookie , Header
1718from fastapi .requests import HTTPConnection
1819from fastapi .security import OAuth2AuthorizationCodeBearer
1920from fastapi .security .utils import get_authorization_scheme_param
@@ -274,8 +275,13 @@ def sync_auth_flow(self, request):
274275class CommonHttpOAuth (OAuth2AuthorizationCodeBearer ):
275276 """Extended version of OAuth2 Auth to work with both WebSockets and HTTP Requests"""
276277
277- async def __call__ (self , request : HTTPConnection ) -> str | None :
278- authorization = request .headers .get ("Authorization" )
278+ async def __call__ (
279+ self ,
280+ request : HTTPConnection ,
281+ auth_header : str | None = Header (alias = "Authorization" , default = None ),
282+ auth_cookie : str | None = Cookie (alias = "Authorization" , default = None ),
283+ ) -> str | None :
284+ authorization = auth_header or auth_cookie
279285 scheme , param = get_authorization_scheme_param (authorization )
280286 if not authorization or scheme .lower () != "bearer" :
281287 if self .auto_error :
You can’t perform that action at this time.
0 commit comments