fastapi_msal icon indicating copy to clipboard operation
fastapi_msal copied to clipboard

Not working for multiple workers by uvicorn

Open maveius opened this issue 8 months ago • 3 comments

Describe the bug Did anyone tried to use it for multiple workers >1 like 4 ? uvicorn app.main:app --host 0.0.0.0 --port 8001 --workers 4 When multiple workers by uvicorn I think that different sub-processes are inside and session is not shared between workers (processes) then issue like detail "AADSTS501481: The Code_Verifier does not match the code_challenge supplied in the authorization request. Trace ID:..."

To Reproduce Steps to reproduce the behavior:

  1. Run in docker by uvicorn app with workers 4 uvicorn app.main:app --host 0.0.0.0 --port 8001 --workers 4
  2. Click on login button
  3. Wait for result
  4. See error "AADSTS501481: The Code_Verifier does not match the code_challenge supplied in the authorization request. Trace ID:..."

Expected behavior It should not depend on which worker has this code in memory in one single session, but should share between processes.

Environment Settings

  • OS: Linux / Docker (python:3.12)
  • Python Version: 3.12
  • Package Versions:
  • msal: 1.32.3
  • fastapi: 0.115.13
  • fastapi_msal: 2.1.7

Additional context

maveius avatar Jun 24 '25 12:06 maveius