Skip to main content

Mulesoft

"Mulesoft provides integration software for connecting applications, data and devices. The company's Anypoint Platform integrates software as a service (SaaS), on-premises software, legacy systems and other platforms"

Configuration​

References: Create a Connected App, Client Credentials

Pre-requisites: An existing Mulesoft subscription or signup for a free trial version.

Setting up Mulesoft​

Login to your Mulesoft account. Open the top left accordion menu and click on Management Center -> Access Management.

Quick Settings

Click on the Connected Apps left hand menu item followed by the Create app button.

Quick Settings

Fill in the Name input field and check the App acts on its behalf (client credentials) radio input and click on the Add Scopes button.

Quick Settings

Click on Select all for the relevant scopes. In this example we choose all of Anypoint Monitoring. Click on the Next button.

Quick Settings

Check the relevant business groups. Click on the Next button.

Quick Settings

Click on the Add Scopes button.

Quick Settings

Click on the Save button.

Quick Settings

Click on the Copy Id and Copy Secret buttons saving the respective values to a secure and safe place.

Quick Settings

Open the top left accordion menu and click on Management Center -> Access Management> Business Group.

Click on the desired Business Group Name and copy the value of Business Group Id and save this value to a secure and safe place. This will be your orgId necessary for REST request path.

orgId

Configuring Mulesoft OAuth Credentials in crul​

Navigate to the credentials page in crul (top right corner menu credentials).

OAuth > Mulesoft

Click the create button.

Select OAuth Provider (Client Credentials) from the type dropdown, then select Mulesoft from the provider dropdown.

Copy the Mulesoft Id value into the Client Id credentials form entry. Then copy the Mulesoft Secret into the Client Secret credentials form entry.

Test the credential by running the following query. You should see a populated token.access_token column in the results.

oauth --credential "mulesoft"

Example queries​

NOTE: Replace all <> with respective values copied from Mulesoft configuration.

Raw oauth command authentication​

oauth
--auth.tokenHost "https://anypoint.mulesoft.com"
--auth.tokenPath "/accounts/api/v2/oauth2/token"
--client.id "<Consumer Key>"
--client.secret "<Consumer Secret>"
--grant "clientcred"

Shortened oauth command with credential reference​

oauth --credential "mulesoft"

Shortened api command with credential reference​

api GET "https://anypoint.mulesoft.com/<RESOURCE>" --credentials.oauth "mulesoft"

Shortened oauth command with curl command​

oauth --credential "mulesoft"
|| curl "https://anypoint.mulesoft.com/<RESOURCE>" -H "Authorization: Bearer $token.access_token$"