oauth-2.0apache-supersetflask-appbuilderflask-oauthlib

OAuth Superset integration - custom_token_headers not passed to access_token_url


I am following this link for OAuth integration of superset - https://superset.apache.org/docs/installation/configuring-superset.

As per the configuration:

AUTH_TYPE = AUTH_OAUTH
OAUTH_PROVIDERS = [
    {   'name':'egaSSO',
        'token_key':'access_token', # Name of the token in the response of access_token_url
        'icon':'fa-address-card',   # Icon for the provider
        'remote_app': {
            'client_id':'myClientId',  # Client Id (Identify Superset application)
            'client_secret':'MySecret', # Secret for this Client Id (Identify Superset application)
            'client_kwargs':{
                'scope': 'read'               # Scope for the Authorization
            },
            'access_token_method':'POST',    # HTTP Method to call access_token_url
            'access_token_params':{        # Additional parameters for calls to access_token_url
                'client_id':'myClientId'
            },
            'access_token_headers':{    # Additional headers for calls to access_token_url
                'XYZ': 'mock-header xyz'
            },
            'api_base_url':'https://myAuthorizationServer/oauth2AuthorizationServer/',
            'access_token_url':'https://myAuthorizationServer/oauth2AuthorizationServer/token',
            'authorize_url':'https://myAuthorizationServer/oauth2AuthorizationServer/authorize'
        }
    }
]

# Will allow user self registration, allowing to create Flask users from Authorized User
AUTH_USER_REGISTRATION = True

# The default user self registration role
AUTH_USER_REGISTRATION_ROLE = "Public"

As per this configuration we expect that the access_token_url should be invoked with a header called XYZ with value as 'mock-header xyz'. However, the actual call includes the below header

Authorization: Basic Base64EncodedmyClientIDandMySecret

Is this the expected behaviour? Or should it get overridden by the headers configured above?


Solution

  • Finally used nginx to drop the Authorization Header for a specific request as could not figure out a solution from superset.