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.