The mocking service in exchange is private by default. Integrating the mocking service with Okta OAuth 2.0 server provides a convenient way to test the API specification with the mocking service in Exchange.
To verify that your server was created and has the expected configuration values, you can send an API request to the Server’s OpenID Connect Metadata URI: https://dev-xxxxxx.oktapreview.com/oauth2/${authServerId}/.well-known/openid-configuration using an HTTP client or by typing the URI inside of a browser. This will return information about the OpenID configuration of your authorization Server. If you use the default server, the URI would be https://dev-xxxxxx.oktapreview.com/oauth2/default/.well-known/openid-configuration. Please note dev-xxxxx is different in each account, replace it with your Dev account ID.
securedBy: oAuth2
securitySchemes:
oAuth2:
description: |
OAuth2 test.
type: OAuth 2.0
describedBy:
headers:
Authorization:
description: |
Used to send a valid OAuth 2 access token. Do not use
with the "access_token" query string parameter.
type: string
responses:
401:
description: |
Bad or expired token. This can happen if the user
revoked or expired an access token. To fix, re-authenticate
the user.
403:
description: |
Bad OAuth request (wrong consumer key, bad nonce, expired
timestamp...). Unfortunately, re-authenticating the user won't help here.
settings:
authorizationUri: https://dev-xxxxxx.oktapreview.com/oauth2/default/v1/authorize
accessTokenUri: https://dev-xxxxxx.oktapreview.com/oauth2/default/v1/token
authorizationGrants: [ client_credentials ]
scopes:
- customScope
A complete sample is attached ex-oauthz_sample.zip
curl https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/b2ee7923-e6c7-4ca3-86a0-6304559b935d/ex-oauthz_sample/1.0.0/m/products
{"code":"UNAUTHENTICATED_ACCESS_TO_RESOURCE","message":"Error trying to access to the resource
b2ee7923-e6c7-4ca3-86a0-6304559b935d:ex-oauthz_sample:1.0.0. Either the authorization is invalid or the session might have expired"}%
There is a known issue when using Chrome browser to make the token request, which is described in this Okta article. You will see the below error message in Exchange API Console:
You can copy the request as a cURL command with the Developer Tools > Network tab, right-click on the failing call, "Copy as cURL", then remove the "Origin" header and run it in a command line terminal.
001114724

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.