RuntimeError: Missing "jwks_uri" in metadata for flask and Google authlib

Viewed 514

Showing the error

Not sure why the error is occurring as I have registered the oauth and have even downgraded my authlib version to 0.12.1 and still no fix. The main overarching issue is that I get an internal server error of 500 with the flask app and this jwks_uri showed up as the runtime error.

1 Answers

Not sure what your code looks like, but when you register via oauth.register do you have server_metadata_url? Not having server_metadata_url made my app throw the following error:

  • RuntimeError: Missing "jwks_uri" in metadata

"AUTH0_DOMAIN" in this instance would be your auth0 domain.

auth0 = oauth.register(
    'auth0',
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
    api_base_url="https://" + AUTH0_DOMAIN,
    access_token_url="https://" + AUTH0_DOMAIN + "/oauth/token",
    authorize_url="https://" + AUTH0_DOMAIN + "/authorize",
    client_kwargs={
        'scope': 'openid profile email',
    },
server_metadata_url=f'https://{AUTH0_DOMAIN}/.well-known/openid-configuration'
)

You can scroll through the official tutorial to the section that has a snippet of code similar to the one I have shown above.

https://auth0.com/docs/quickstart/webapp/python/01-login

Related