I am successfully redirected to my Cognito login page. However, when Cognito redirects back to my app, the page I am redirecting to (pages/folder/page1.py) receives a 302 response and is redirected to localhost:8052. During this redirection, the ?code parameter (which I need to obtain the auth token) is lost.
Does anyone know why this is happening or how to fix it?
Additionally, when I don’t use OIDCAuth, the URL /folder/page1 works as expected.
The callback route is not the route the OIDC server redirects to when the user is authenticated, but the route that handles the “oidc dance”. You have overwritten that route with your page route, thats why the token gets lost.
Setting the redirect URI is usually done with the OIDC provider, at least is that the case for microsoft oidc.
Thanks for your quick response! I’m still pretty new to OIDC, so I appreciate your patience. When you mention the route that handles the “OIDC dance,” could you clarify what that means? What exactly should I put there?
From what I understand in the documentation, I thought that it refered to the redirect uri:
Here’s what I found in the docs:
callback_route: str, optional
The route for the OIDC redirect URI, it requires an <idp> placeholder, by default "/oidc/<idp>/callback".
Just want to make sure I’m on the right track. Thanks again for your help!
Thanks, man! You were right! It was step 5-6—thank you so much!
I was really confused because, in another frontend, I had to handle that part myself (exchanging the code with the auth server for a token) and manually set the redirect_uri.