Postman — OAuth 2.0 Authentication

Ghanshyam Shukla
2 min readApr 5, 2024

--

With OAuth 2.0, you first retrieve an access token for the API, then use that token to authenticate future requests. Access tokens are typically short-lived, but the authorization server can also provide a long-lived refresh token. A client application can use the refresh token to automatically

Lets do step by step, how we can do OAuth 2.0 Authentication via Postman and send token in HTTP request’s header

Step 1: Open Postman and go to Authorization tab => Select OAuth 2.0 from drop down as below:

Step 2: Add configurations to generate token as below:

  1. Header Prefix — Bearer
  2. Token Name — Any Name
  3. Grant Type — Implicit
  4. Callback URL — give any client web app URL
  5. Auth URL — Authorization Server URL
  6. Client ID — should be of web client
  7. Scope — can give multiple scopes separated by space
  8. Client Authentication — Select — Send client credentials in body

Step 3: Now click on Generate Token button available at the end as:

Step 4: It will open a screen ask to enter credentials. Add valid credentials (Username + Password) and token get generated as:

Step 5: Now start doing HTTP calls and Authentication header automatically gets attached with every call.

Step 6: When you get 401, just again repeat Step 3 onwards

References

https://in.linkedin.com/in/ghanshyam-shukla-52b42070

--

--

Ghanshyam Shukla
Ghanshyam Shukla

Written by Ghanshyam Shukla

Consultant — Software Development

No responses yet