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.
RuntimeError: Missing "jwks_uri" in metadata for flask and Google authlib
2.9k views Asked by Ruhan Ponnada At
3
There are 3 answers
0
On
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.
1
On
this was what worked for me
google = oauth.register(
name='google',
client_id='',
client_secret='',
access_token_url='https://accounts.google.com/o/oauth2/token',
access_token_params=None,
authorize_url='https://accounts.google.com/o/oauth2/auth',
authorize_params=None,
api_base_url='https://www.googleapis.com/oauth2/v1/',
userinfo_endpoint='https://openidconnect.googleapis.com/v1/userinfo',
# This is only needed if using openId to fetch user info
client_kwargs={'scope': 'openid email profile'},
jwks_uri = "https://www.googleapis.com/oauth2/v3/certs"
)
if you are using Google authlib just add server_metadata_url= 'https://accounts.google.com/.well-known/openid-configuration' to the oauth.register it worked for me, For example: