Skip to content

Can't create optionally authenticated path in FastAPI #150

Answered by frankie567
kschniedergers asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @kschniedergers 👋

It looks like you're using FastAPI. Did you make sure to set auto_error=False to the scheme:

scheme = OAuth2AuthorizationCodeBearer(  
    "https://example.fief.dev/authorize",  
    "https://example.fief.dev/api/token",  
    scopes={"openid": "openid", "offline_access": "offline_access"},
    auto_error=False,  # 👈 That's important 
)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kschniedergers
Comment options

Answer selected by kschniedergers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants