You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experiencing an issue with the fastapi-sso library when defining the redirect_uri within the get_login_redirect method instead of during the initialization of the GoogleSSO instance.
When the redirect_uri is set during the initialization of GoogleSSO, everything works correctly under both HTTPS (with Nginx) and localhost.
When the redirect_uri is moved to the get_login_redirect method, it works on localhost but fails with HTTPS behind Nginx.
Error:
The following error is encountered when attempting to log in with Google under HTTPS using Nginx:
oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request)
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure.
You can let the app developer know that this app doesn't comply with one or more Google validation rules.
Reproduction Steps:
Define the redirect_uri within the get_login_redirect method:
Hey, thanks for opening this issue and for the code example! I've actually stumbled upon the same thing just this week, it seems to me that the handling is different and if you pass the redirect_uri to get_login_redirect, you also need to pass it to verify_and_process, which is stupid and confusing. I'll take a look at what I can do about it, hopefuly this weekend.
Problem:
I am experiencing an issue with the
fastapi-sso
library when defining theredirect_uri
within theget_login_redirect
method instead of during the initialization of theGoogleSSO
instance.redirect_uri
is set during the initialization ofGoogleSSO
, everything works correctly under both HTTPS (with Nginx) and localhost.redirect_uri
is moved to theget_login_redirect
method, it works on localhost but fails with HTTPS behind Nginx.Error:
The following error is encountered when attempting to log in with Google under HTTPS using Nginx:
Reproduction Steps:
Observed Behavior:
Works correctly on localhost.
It fails with HTTPS (Nginx) and returns the above error.
Expected Behavior:
Defining the
redirect_uri
dynamically within get_login_redirect should work consistently across environments, including HTTPS.Environment:
fastapi==0.115.5
fastapi-sso==0.17.0
Python: docker image 3.11-slim
Nginx: docker image latest (1.27)
Running in a Docker container.
code example: https://github.com/nimaxin/fastapi-sso-nginx.git
The text was updated successfully, but these errors were encountered: