Using Okta as an External IDP with OIDC

Follow the instructions below to connect Okta as a third-party Identity Provider to WSO2 API Manager.


Before you begin, make sure you do the following.

  1. Create an account in
  2. Download the WSO2 API Manager distribution from
  3. Enable the email domain on WSO2 API Manager.

    You need to enable this because Okta uses the email as the username by default. As the email domain is not enabled by default, you have to enable it to use the email as the username in WSO2 API Manager. Once enabled, you can use your email or a normal username as your username.

    Follow the instructions below:

    1. Unzip the WSO2 API Manager distribution.
    2. Open the deployment.toml file, which is located in the <API-M_HOME>/repository/conf/ directory.
    3. Add the following configuration.

      enable_email_domain= true
  4. Start the WSO2 API Manager server.

Step 1 - Configure Okta


For more information on working with the Okta Admin Portal, see the official Okta documentation.

  1. Navigate to the Okta Admin Portal.

  2. Add an application in Okta.

    Select Web as the platform type of the application and create an application based on the following application settings.

    Field Value
    Name oidc_app
    Base URIs Let's not add a new base URI
    Login Redirect URIs https://localhost:9443/commonauth
    Logout Redirect URIs https://localhost:9443/commonauth
    Group Assignments Everyone
    Grant type allowed Authorization Code

  3. Add an attribute to the default user profile.

    Add a new attribute, with the following details, to the default user profile of Okta to represent the user role.

    Field Value
    Data Type String
    Display Name Role
    Variable Name role
    Attribute Length Between

  4. Add the claims that need to be returned from the ID Token in Okta.

    These claims will be used to map the user details with WSO2 API Manager for authentication and authorization purposes.

    Let's add two claims that have the following details.

    Claim 1

    Field Value
    Name wso2user
    Include in token type ID Token
    Value Type Expression
    Value user.login
    Include in The following scopes:

    Claim 2

    Field Value
    Name roles
    Include in token type ID Token
    Value Type Expression
    Value user.login
    Include in The following scopes:

  5. Add a role to the provisioned user in Okta.

    This will enable WSO2 API Manager to map an internal role to the provisioned user. Edit the provisioned user's profile and add any as the Role.

Step 2 - Configure API Manager

  1. Sign in to the WSO2 API-M Management Console.


  2. Create a role that needs to be assigned to users that will be provisioned from Okta.

    1. Click Main, Identity, and then click Add under Users and Roles.

    2. Click Add New Role.

      Add role for Okta in API-M

    3. Add a new role based on the following details and click Finish.

      Field Value
      Domain Primary
      Role Name okta_role

  3. Add scope mapping via the WSO2 API Manager Admin Portal.

    1. Sign in to the WSO2 API Manager Admin Portal.


    2. Click Settings and then click Scope Assignments.

      Scope Assignments menu

    3. Click Add Scope Mappings.

      Okta API-M role permission mapping

    4. Enter okta_role as the role name and click Next.

      Edit Okta API-M role permission mapping

    5. Go to Select permissions, click Custom permissions, and start assigning the permissions as shown below.

      These permissions will allow a user having the okta_role to log in to the Publisher and the Developer Portal.

      Hiererchy Permissions
      • View throttling policies
      • Retrieve and publish Monetization related usage records
      • Create threat protection policies
      • Update and delete mediation policies
      • Update and delete backend endpoint certificates
      • View backend endpoint certificates
      • Publish API
      • Update and delete client certificates
      • Generate Internal Key
      • View API
      • Create mediation policies
      • Get/ subscribe/ configure publisher alerts
      • Update and delete API documents
      • Read permission to comments
      • Write permission to comments
      • Create API documents
      • Update and delete threat protection policies
      • View Subscription
      • Create API
      • Add client certificates
      • Delete API
      • View client certificates
      • Retrieve store settings
      • Block Subscription
      • View mediation policies
      • Add backend endpoint certificates
      • Retrieve, Manage applications
      • Retrieve Developer Portal settings
      • Retrieve, subscribe and configure Developer Portal alert types
      • Generate API Keys
      • Retrieve, Manage subscriptions
      • Subscribe API

      Okta API-M role permission mapping

    6. Click Save to save your changes.

  4. Add an Identity Provider.

    1. Sign in to the WSO2 API-M Management Console.


    2. Click Main and then click Add under Identity Providers.

    3. Enter the Identity Provider's Name.

      Add an IDP for Okta SAML

    4. Expand Federated Authenticators -> OAuth2/OpenID Connect Configuration and add the following details.

      API-M IDP OIDC details

      Field Sample value
      Enable OAuth2/OpenIDConnect True
      Client ID You can find this value from the Okta application that you created.
      Client Secret You can find this value from the Okta application that you created.
      Authorization Endpoint URL https://your_okta_url/oauth2/default/v1/authorize
      Token Endpoint URL https://your_okta_url/oauth2/default/v1/token
      Callback URL https://localhost:9443/commonauth
      Userinfo Endpoint URL https://your_okta_url/oauth2/default/v1/userinfo
      Logout Endpoint URL https://your_okta_url/oauth2/default/v1/logoutcode>
      Additional Query Parameters scope=openid profile

    5. Expand Claim Configuration -> Basic Claim Configuration.

      Add the claim configurations as shown in the image below.

      Okta API-M IDP claims details

    6. Expand Role configuration and add okta_role as shown below.

      You can check if the user logged in has the role any and assign the local okta_role.

    7. Enable Just-in-Time Provisioning for the user to be saved in the API Manager user store.


    When Just-In-Time Provisioning is enabled, the user details will be saved in the API Manager user store. User profile details will be updated via the federation following each login event. To preserve the user profile details without any changes, you need to enable SystemRolesRetainedProvisionHandler.

    Add the following to the <API-M_HOME>/repository/conf/deployment.toml file and restart the server.

    provisioning_handler = "org.wso2.carbon.identity.application.authentication.framework.handler.provisioning.impl.SystemRolesRetainedProvisionHandler"
  5. Update the Service Providers.

    1. Click Service Providers -> List in the WSO2 API-M Management Console.

      There are two service providers available by default; apim_publisher and apim_devportal.

    2. Click Edit to edit apim_publisher.


      You need to have signed in to the Developer Portal and Publisher at least once for the two service providers to appear, as it is created during the first sign in.

      Okta API-M role OIDC SP

    3. Expand Local & Outbound Authentication Configuration under Federated Authentication and select the identity provider you created.

      Okta API-M role OIDC SP outbound

    4. Repeat the latter mentioned two steps for apim_devportal.

      Now you will be able to Sign in to the Publisher and Developer Portal using Okta.

      Okta API-M login