I would suggest trying the OAuth2 approach with dependency injection via Depends(oauth2_scheme).
Depends(oauth2_scheme)
There is an example in the docs: https://fastapi.tiangolo.com/tutorial/security/oauth2-jwt/