fastapi_msal icon indicating copy to clipboard operation
fastapi_msal copied to clipboard

authenticating via postman seems impossible

Open benoitmiserez opened this issue 4 months ago • 2 comments

Hello, thanks for the amazing repo.

I can successfully authenticate via the swagger docs as explained in the readme, but I am having trouble authenticating via postman (and other approaches that only use the API). After successfully using the browser to sign in, the /token endpoint is returning 401 Unauthorized.

I traced it back to line 31 in fastapi_msal/security/msal_auth_code_handler.py in MSALAuthCodeHandler().authorize_access_token(), where an auth_code seems to be retrieved from the session.

auth_code: Optional[AuthCode] = await AuthCode.load_from_session(session=SessionManager(request=request))

This does not seem to work via postman. Is this intended/expected behavior? How can I best solve this?

Thanks in advance!

benoitmiserez avatar Aug 05 '25 13:08 benoitmiserez