OpenID Connect metadata document has the information of the URLs we need to configure OpenID Connect in the Anypoint Platform.
Please make sure the following URLs:
match the URLs from the metadata received from Step 1.
IMPORTANT:
When an authorization code is used to obtain an access token during user login, it cannot be reused in step 4 below to request another access token. Attempting to do so will result in the error: "OAuth2 Authorization code was already redeemed."
To prevent the authorization code from being redeemed during troubleshooting, you can temporarily modify the Token URL to an invalid one. However, ensure you evaluate the impact of this change on other users before proceeding.
OpenID Connect based SSO is based on OAuth. After a user is authenticated, an authorization code is returned from IdP as a redirect to the Anypoint Platform. Please see the sequence diagram below:
To troubleshoot the "Unauthorized" issue, we need to capture the authorization code redirected to the Anypoint Platform. Please reference "How to retrieve HTTP archive files (HAR)" to capture the HAR file or the redirect call.
Open the HAR file and look for the OpenID Connect 302 redirect response:
"response": {
"status": 302,
"statusText": "Found",
extract the code from the location value. For example the following:
{
"name": "Location",
"value": "https://anypoint.mulesoft.com/accounts/login/your_domain/redirect?code=xxxx&session_state=xxxx"
},
The code is the query parameter in the redirect URL.
Anypoint Platform will use the received code to get an OAuth token. Please try simulating the call using curl or Postman to see if it works, like:
curl -v --user '<client_id>:<client_secret>' <token_URL> -X POST -F 'grant_type=authorization_code' -F 'redirect_uri=https://anypoint.mulesoft.com/accounts/login/<your_domain>/redirect' -F 'code=<authorization_code>'
For EU control plane, please execute the command below.
curl -v --user '<client_id>:<client_secret>' <token_URL> -X POST -F 'grant_type=authorization_code' -F 'redirect_uri=https://eu1.anypoint.mulesoft.com/accounts/login/<your_domain>/redirect' -F 'code=<authorization_code>'
Please replace:
if working, you will get the token like:
{"token_type":"Bearer","expires_in":"3599","ext_expires_in":"0","expires_on":"1527224212","not_before":"1527220312","resource":"xxxx","access_token":"YOUR_TOKEN"}
Be note that the token required is "access_token". It's been noticed that when setting up IDP with Azure B2C, Azure IDP returns "id_token" only without returning "access_token". The "access_token" is required to fetch "/userinfo" outlined in step5. To retrieve the "access_token" via Azure B2C, please configure the scopes properly as per the link (i.e., https://<your-tenant-name>.onmicrosoft.com/api/openid email profile)
If there's an error, please check with your IdP on the error.
Note, the client id/secret can be passed in as a basic authentication header or in the POST body. Anypoint Platform will check what's described in the metadata configuration (section "token_endpoint_auth_methods_supported") and pick a supported authentication method.
Anypoint Platform will get the user info by making a call to the configured userinfo URL with the token received from Step 4.
Please try simulating the call using curl or Postman to see if it works, like:
curl -v -H 'Authorization: Bearer <Token>' <user_info_URL>
Please replace:
If you are able to retrieve the userinfo via curl command above but still getting an issue with retrieving the userinfo, please ensure to have the user profile updated properly as per the document. Typically, the OpenID Connect userinfo endpoint provides a preferred_username claim that contains the authenticated user’s username.
If there's an error, please check with your IdP about the error.
Check role mapping is done correctly.
For the role element, check if idp is sending role as below "role": ["role1", "role2", "role3"] and not as "role":"[role1, role2, role3]"
If all above are checked while "Unauthorized" is still seen, please open a Support case with all artifacts from the above steps:
With the above information, support will be able to complete further investigations into the possible reasons for the authentication failure.
if you run into the below errors please review this document and also your Ping configuration Configuring Anypoint Platform as a “Ping Identity” Service Provider (SP) using OIDC
1) 502 Bad Gateway The request could not be processed at this time
001114931

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.