Using OKTA As An External IDP With OIDC
In the following document we will explain how to connect OKTA as a third party Identity provier to WSO2 API-Manager. Before we start first make sure you have all the pre-requisites mentioned below.
- Create an account in https://developer.okta.com/
- Download WSO2 API Manager 3.1.0 distribution from
- Unzip the distribution and open the
deployment.tomlfile located in
<APIM_HOME>/repository/conf/and add the following configuration
This is needed since OKTA uses the email as the username by default, therefore to use the email as the username in WSO2 API-Manager we have to enable it since it not enabled by default. Once enabled both email as username and normal usernames can be used.
[tenant_mgt] enable_email_domain= true
- Start the Server.
Select type web and use the following details
Enter the following details and click save
Next we need to add the claims that needs to be returned from the ID Token in okta. These are the claims we will be used to map the user details to WSO2 API-Manager side. Navigate to API -> Authorization Servers and select the default server
Add the following two claims
Go to Users -> People and click on your profile name. And navigate to the profile edit page as shown below
add the following role value. This will be used in the API-Manager to map an internal role to user that will be provisioned.
Login in to
First we need to create a role that needs to be assinged to users that will be provisioned from okta. click on add in Users and Roles section and add a new role.
Assign the following permissions to the role and save
https://localhost:9443/adminexpand settings & click on scope mapping
Update the following scopes with the okta_role
This will allow the user a user having the okta_role to login to Publisher and Developer Portal
Login in to
https://localhost:9443/carbon& Click on add in identity providers section. Enter Identity Provider Name.
Field Sample value Enable OAuth2/OpenIDConnect True Client id Can be found in the okta application you created Client secret Can be found in the okta application 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/logout Additional Query Parameters scope=openid%20profile
Expand Role configuration and add the following role. Here we check if the user that is being logged in has the role
anyand assign him the local role okta_role
Enable Just in time provisioning so that the user will be saved in the API-Manager user store
Navigate to Service providers -> list as shown below. There are two service providers created apim_publisher, apim_devportal. Click on edit on apim_publisher.
You will have to logged into the Developer Portal and Publisher at least once for the two service providers to appear as it is created during first login.
Expand local and outbound authentication configuration and under federated authentication select the name of the identity provider you created.
Repeat the same for apim_devportal service provider.
Now you are able to login to the Publisher & Developer Portal using OKTA.Top