Auth0 Userinfo endpoint returns empty object

Hi, I have fetched an access token, but when I try to call userinfo endpoint with it - it returns empty object.
Tenant name: dev-1y03nqe5vd3rtzha
I used api request to fetch access token.
Audience - https://dev-1y03nqe5vd3rtzha.us.auth0.com/userinfo
OpenID Connect (okta) Enterprise Connections.
Code:

{
        "client_id": app_config["auth0_client_id"],
        "connection": app_config["auth0_connection_name"],
        "redirect_uri": os.environ["AUTH0_REDIRECT_URI"],
        "state": request.session.get("state", "/"),
        "response_type": "code",
        "scopes": "openid profile email",
        "audience": app_config["auth0_audience"],
    }

Token:

payload = {
        "grant_type": "authorization_code",
        "code": code,
        "redirect_uri": os.environ["AUTH0_REDIRECT_URI"],
        "scopes": "openid profile email",
        "client_id": app_config["auth0_client_id"],
        "client_secret": app_config["auth0_client_secret"],
        "audience": app_config["auth0_audience"],
    }
    exchange = requests.post(
        f"https://{os.environ['AUTH0_DOMAIN']}/oauth/token",
        headers=headers,
        data=payload,
    )

I tried with and without audience, but the result is the same.

The issue was fixed. In okta we have scopes, But in auth0 it is scope.

1 Like

Hey there @ilokhvytska welcome to the community!

Good to know you were able to get this sorted, and thanks for following up with the solution :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.