<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
System Status
Announcements
Announcements
Search
Search
Select Language

OIDC IdP Authentication Failing With "access_denied" and "400 Bad Request" During /introspect Call in Okta

Okta Classic Engine
Okta Identity Engine
API Access Management

Overview

During an Okta OpenID Connect (OIDC) Identity Provider (IdP) authentication flow, users authenticate successfully at the external provider but receive a 400 Bad Request and an acces_denied error upon redirection. This issue can occur if the external IdP sends an attribute as an array while the Okta IdP User Profile expects a string, causing an error that invalidates the state token. Updating the IdP user profile mapping, changing the attribute data type, or reconfiguring the external IdP resolves this issue. The browser displays the following error:

 

Identity Provider: OIDC, Error Code: access_denied

 

A review of network requests for this login event in the browser reveals a 400 Bad Request occurring at https://<org>.okta.com/login/error/redirect?stateToken=<token> immediately after Okta receives the authorization code.

 

400 Bad Request

 

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • OpenID Connect (OIDC)
  • Identity Provider (IdP)

Cause

This error is caused by a type mismatch for an attribute (claim) being sent by the Identity Provider. For example, an external IdP may send a role attribute as an array (for example, role=[member1@example.com, member2@pexample.com]), but the Okta IdP User Profile expects a string for the role attribute. 

 

When Okta attempts to map this array into a string field, Okta triggers an error. Because of this, Okta never successfully processes the AuthStateToken, rendering it invalid. Okta redirects the browser to an error page using the invalid state token, resulting in the 400 Bad Request error. No error appears in the Okta Admin Console System Log because the failure happens at a low-level mediation layer before Okta finalizes the event.

 

The failure results from a data type mismatch during the profile mapping phase of the /introspect operation.

Solution

How is the attribute type mismatch resolved?

Resolve the attribute type mismatch by updating the IdP user profile mapping, modifying the IdP attribute definition, or reconfiguring the external IdP.

 

How is the Identity Provider user profile mapping updated?

Update the IdP user profile mapping to handle multi-valued attributes by applying an expression to the role attribute mapping.

  1. Navigate to Directory > Profile Editor.
  2. Select the Mappings for the affected OIDC Identity Provider.
  3. Apply an expression to the role attribute mapping to take the first value or convert the entire array to a string.
  4. Extract the first value from the array by applying the following expression.
    Arrays.get(appuser.role, 0)
  5. Convert the entire array to a string by applying the following expression.
    Arrays.toCsvString(appuser.role)

     

How is the Identity Provider attribute definition updated?

Update the IdP attribute definition to accept a string array instead of a single string.

  1. Navigate to Directory > Profile Editor and open the IdP User profile.
  2. Locate the role attribute and select the edit icon.
  3. Change the Data type from string to string array.

 

NOTE: Ensure the target Okta User attribute also updates to an array or maps accordingly.

 

How is the external Identity Provider reconfigured?

Reconfigure the external IdP to send the role attribute as a single string instead of a JSON array if multi-valued roles are unnecessary for the integration.

Loading
OIDC IdP Authentication Failing With "access_denied" and "400 Bad Request" During /introspect Call in Okta | Okta Support