RuntimeError: Missing "jwks_uri" in metadata for flask and Azure AD authlib

2.1k views Asked by At

I tried login in via Azure AD in airflow container. I setting de webserver_config.py

OAUTH_PROVIDERS = [
    { 
        'name':'azure', 'token_key':'access_token', 'icon':'fa-windows',
        'remote_app': {
            "api_base_url": "https://login.microsoftonline.com/$TENANT_ID",
            "request_token_url": None,
            'request_token_params': {
                'scope': 'openid email profile'
            },
            "access_token_url": "https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token",
            "access_token_params": {
                'scope': 'openid email profile'
            },
            "authorize_url": "https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/authorize",
            "authorize_params": {
                'scope': 'openid email profile'
            },
            'client_id':'CLIENTE_ID',
            'client_secret':'CLIENTE_SECRET'
        }
    }

]

Log Webserver UI

See logging

Error authorizing OAuth access token: Missing "jwks_uri" in metadata
1

There are 1 answers

2
alexis.araya On

I found solution, adding authlib 1.0.1 and add

OAUTH_PROVIDERS = [
{ 
    'name':'azure', 'token_key':'access_token', 'icon':'fa-windows',
    'remote_app': {
        "api_base_url": "https://login.microsoftonline.com/$TENANT_ID",
        "request_token_url": None,
        'request_token_params': {
            'scope': 'openid email profile'
        },
        "access_token_url": "https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token",
        "access_token_params": {
            'scope': 'openid email profile'
        },
        "authorize_url": "https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/authorize",
        "authorize_params": {
            'scope': 'openid email profile'
        },
        'client_id':'CLIENTE_ID',
        'client_secret':'CLIENTE_SECRET',
        'jwks_uri': 'https://login.microsoftonline.com/common/discovery/v2.0/keys
    }
}