flask-dance icon indicating copy to clipboard operation
flask-dance copied to clipboard

Google client_secret and_client_id ignored when env var are present

Open dc740 opened this issue 5 years ago • 7 comments

The following client_id and client_secret are ignored

google_bp = make_google_blueprint(
    scope=["profile", "email"],
    client_id=settings.ADMIN_GOOGLE_OAUTH_CLIENT_ID,
    client_secret=settings.ADMIN_GOOGLE_OAUTH_CLIENT_SECRET,
)

The application is automatically using these other variables (note the missing ADMIN_ prefix)

GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET

I don't want this, since they are used in another part of the app, in another oauth code, for other purposes. To workaround the issue I have to manually set the variable names like this:

google_bp.from_config["client_id"] = "ADMIN_GOOGLE_OAUTH_CLIENT_ID"
google_bp.from_config["client_secret"] = "ADMIN_GOOGLE_OAUTH_CLIENT_SECRET"

As a side note... I've been hitting a constant login loop without any errors, like the one documented here: https://stackoverflow.com/questions/49749572/google-oauth-with-flask-dance-always-redirect-to-choose-account-google-page

And I'm starting to wonder if this bug is the culprit.

dc740 avatar Jul 25 '19 00:07 dc740