How to Get OAuth Access Token and Use It to Call APIs on Postman

OAuth is an open-standard authorization protocol that provides applications with “secure designated access.” OAuth does not share password data but instead uses authorization tokens to prove an identity between consumers and service providers.

You can use OAuth to authenticate all your API requests to Comm100. OAuth provides a more secure way for your application to access your account data without requiring sensitive information like email and password to be sent with the requests.


Prerequisite

You must have admin-level access to the Postman application.


Step 1: Get the OAuth Access Token

To get the OAuth Access Token, follow these steps:

  1. Log in to Postman.
  2. Go to Home > Create New > HTTP Request.
  3. Select the POST method and provide the URL. While generating an access token, the API request should start with your platform domain followed by the curl command, which is different from other API requests.
    For example, if your Control Panel domain is dash17.comm100.io, the API request should be https://dash17.comm100.io/oauth/tokenkb-OAuth-01.png
  4. Go to Body > x-www-form-urlencoded tab.
  5. Input the following Keys and their Values. To learn more about the OAuth token parameters, see OAuth Authentication.kb-OAuth-02.png
    For example:
    • email: XXXXXXXX
    • password: XXXXX
    • grant_type: password
    • client_id: XXXXXX
  6. Click Send.
    You get the OAuth Access Token to call APIs. 
  7. Copy the OAuth Access Token to your clipboard.kb-OAuth-03.png


Step 2: Use the OAuth Access token to call an API 

To call an API using the OAuth Access Token, follow these steps:

  1. Select the GET method and provide the API request URL. The following example requests a Get a single Chat API: https://api17.comm100.io/v4/livechat/chats/fdbf4b5c-ce71-442f-a84c-28ee83aa3922\
    To learn about Comm100 API request URL, see Comm100 Restful API Guide.
  2. Go to the Authorization tab and choose the authentication type as OAuth 2.0.
  3. Paste the OAuth Access Token in the Access Token field. 
  4. Ensure that the Header Prefix field is Bearer
  5. Click Send.

kb-OAuth-04.png

 You get the response data successfully.