API authorization token generation without postman

Based on my experience below were the steps required to generate bearer token. Posting here to help someone in future

  1. The first mistake was not encoding client id and password in Base64.This needs to be passed in header in Base64 encoded format.

authorization: Basic ’

  1. Write clientid:Clientsecret and convert to Base64

  2. Append ?grant_type=client_credentials in your token URL

eg https://xxxxx/oauth2/xxxxxxx/v1/token?grant_type=client_credentials

Body can be blank. Nothing else was required to generate token.

Refer the screenshot below to see how my API Post request header looks to generate token. No authorization request required separately any tool having a capability of sending post request can be used.

1 Like