You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be very easy to add support to WebSockets, just replacing the dependency type from starlette.requests.Request to starlette.requests.HTTPConnection.
When you want to define dependencies that should be compatible with both HTTP and WebSockets, you can define a parameter that takes an HTTPConnection instead of a Request or a WebSocket.
I tried a quick patch replacing it in AzureAuthorizationCodeBearerBase.__call__ and in OAuth2AuthorizationCodeBearer.__call__, and it worked perfectly.
HTTPConnection is the base class for both WebSocket and Request, and it has the headers and state properties, so it would probably be backwards compatible.
Let me know if you think it is feasible! If you need hands on, I can try to do a PR.
The text was updated successfully, but these errors were encountered:
Hello!
First of all thank you for this repo! It has saved me a lot of time.
I have tried to use
SingleTenantAzureAuthorizationCodeBearer
with a web socket connection and FastAPI throws this error:TypeError: AzureAuthorizationCodeBearerBase.__call__() missing 1 required positional argument: 'request'
I think it would be very easy to add support to WebSockets, just replacing the dependency type from
starlette.requests.Request
tostarlette.requests.HTTPConnection
.As described in documentation:
I tried a quick patch replacing it in
AzureAuthorizationCodeBearerBase.__call__
and inOAuth2AuthorizationCodeBearer.__call__
, and it worked perfectly.HTTPConnection
is the base class for bothWebSocket
andRequest
, and it has theheaders
andstate
properties, so it would probably be backwards compatible.Let me know if you think it is feasible! If you need hands on, I can try to do a PR.
The text was updated successfully, but these errors were encountered: