OpenID Connect with MuleSoft Anypoint and Okta

Cloud Architect
3 min readApr 16, 2023

The previous article we connected Okta OAuth and Microsoft Azure Functions. Now that is established we can call from MuleSoft Anypoint.

Step 1: Create the MuleSoft AnyPoint project

Define a new Mule project, along with a simple workflow using Listener and a Request elements.

Define a simple HTTP Listener to run on your local machine:

Define the Request properties with your OAuth enabled endpoint:

Set up the Request element to Azure. In this example I am explicitly passing the query parameters.

Run locally and invoke from Postman. You should get a 401 unauthorised error.

Step 2: Add OAuth

Add the OAuth Module to your project. This will just enable OAuth as an option in our existing Request element:

The request will now have a client credentials authorization type. Enter your Okta token url, client id and client secret:

Run the project again, and you should see a successful call this time:

Notes

  1. This is running on MuleSoft AnyPoint Studio 7.14
  2. You can use this method to connect to OAuth enabled services from MuleSoft. They don’t have to use Okta or Microsoft Azure.
  3. I didn’t bother deploying the MuleSoft app to CloudHub for this simple scenario. If you want to try, just change the listener to HTTPS.

--

--