1. Home
  2. ...
  3. OAuth 2.0: flows to obtain an access token
  4. OAuth Test: how to test and set up OAuth requests in your environment

OAuth Test: how to test and set up OAuth requests in your environment

Step by step with Postman to import the environment, the request collection and generate a code.

To help you better understand and use OAuth in your environment, we put together this simple tutorial explaining how to configure a request collection using Postman.

Before you start, you must have Postman installed on your machine. You will also need an app registered with a plan to access the desired API on the API Manager. Finally, your API must contain an OAuth or JWT interceptor (depending on your security strategy) to validate the flow.

Let's start, then!

Importing the environment

The first step is importing the environment that will be used for the calls.

To do that, use the JSON file below, changing the following fields according to your environment:

  • ENVIRONMENT: add the name of your environment (e.g., demov3);
  • OAUTH_APP_CLIENT_ID: client ID of the app that will use the OAuth service;
  • OAUTH_APP_CLIENT_SECRET: client secret of the app that will use the OAuth service.

After you save the JSON file, use the Postman import function.

Importing the collection of requests

To import the collection of requests (V2), follow these steps:

Download the collection OAuth 2.0;

Unzip the "OAUTH2.0.postman_collection.zip" folder;

Open Postman and click the Import button;

Select the saved .json file and click "Open" to import it.

After importing, you will have a folder containing all the requests, as shown in the image below.

Generating a code

To test and use the OAuth flow in your environment, generate a code through the item Grant-code. You can find this request on the root folder of the request collection you have just set up.

TIP

Remember this request, because you will use it in all the tests you perform.

Finally, after you execute the Grant-code request, you will be able to generate the access token that your strategy will use (be it JWT, Authorization Code, Client Credentials, Implicit, Password or Refresh Token).

How happy are you with this page?

We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more