Open In App

What are authentication methods supported in Postman?

Last Updated : 19 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

An API platform called Postman is used to create and use APIs. With Postman, you can design better APIs more quickly by streamlining collaboration and simplifying each step of the API lifecycle. Authentication in Postman verifies a user’s identification. It includes sending a validated username and password with a request. In this article, you will be exploring different types of authentication methods that are available in Postman.

Prerequisite:

What is the need of Authentication in APIs?

APIs use authorization to insure that client requests access data securely. This can involve authenticating the sender of a request and attesting that they’ve authorization to enter or exploit the applicabledata. However, you can cherry-pick from a variety of auth models, If you are constructing an API. However, the demanded authorization will be specified by the API provider, If you are incorporating a third- party API. You can pass auth details along with any request you shoot in Postman. Auth data can be contained in the header, body, or as parameters to arequest. However, Postman will automatically colonize the applicable parts of the request for your chosen auth type, if you enter your auth details in the Authorization tab.

Screenshot-2023-12-01-074056

Different types of Authentication in Postman

Various types of Authentication Methods in Postman:

Let’s deep dive and explore top five Authentication type in detail:

1. No auth:

Postman will not shoot authorization details with a request unless you define an authtype. By default the No Auth type is selected as authtype in Postman, however if it is not selected you can choose No Auth from the Authorization tab > Type dropdown list, If your request does not need authorization.

2. API auth:

With API key auth, you ship a key-fee pair to the API both inside the request headers or question parameters. In the request Authorization tab, select API Key from the Type listing. Enter your key name and price, and pick out either Header or Query Params from the Add to dropdown listing. You can keep your values in variables for extra security. Postman will append the applicable facts in your request Headers or the URL query string.

APIKey_Postman

API Key in Postman

3. Bearer token:

Bearer tokens allow requests to authenticate using an get entry to key, along with a JSON Web Token (JWT). The token is a text string, blanketed inside the request header. In the request Authorization tab, choose Bearer Token from the Type dropdown list. In the Token area, enter your API key price. For introduced security, save it in a variable and reference the variable by call.

Postman will append the token cost to the textual content Bearer inside the required format to the request Authorization header as follows:

Bearer <Your API key>

To add a bearer token in Postman, you can do the following:

  • Create a variable,
  • Call the Login API,
  • Set variables,
  • Read variables when calling the API.

To pass a bearer token in a header, you can do the following:

  1. Make an HTTP GET or POST request,
  2. Send your bearer token with the Authorization: Bearer {token} HTTP header.
bearertoken

Bearer Token

4. JWT bearer:

A JWT Bearer grant type is used when the client wants to receive access tokens without transmitting sensitive information. It can also be used with trusted clients to gain access to user resources without user authorization.

In the request Authorization tab, select JWT Bearer from the Type dropdown list.

Algorithm – Select an algorithm to use for the JWT token. Supported algorithms consist of:

  • HS – HMAC with SHA
  • RS – RSA (RSASSA-PKCS1-v1_5) with SHA
  • ES – ECDSA with SHA
  • PS – RSA (RSASSA-PSS) with SHA
  • Secret – The secret that’s used with the HMAC-SHA set of rules.
  • Secret Base64 encoded – If the key is encoded in the base-sixty four format.
  • Private key – The non-public key for signing the token for RS, ES, and PS algorithms. Select Select file to add a personal key in PKCS #8 format.
  • Payload – Enter the payload records in your JWT token, in JSON layout.

In the Advanced configuration segment, you can additionally configure the following gadgets. If you don’t configure them, they are generated routinely.

  • Header prefix – An optional prefix to apply at the start of headers. This header prefix is a part of the request and not part of JWT.
  • Headers – Any custom headers you furthermore mght need to send in the JWT token. Headers concerning the chosen algorithm are routinely delivered.
Screenshot-2023-12-02-224009

JWT Bearer

5. Basic auth:

Basic Auth is the most basic type of authentication in Postman. It requires a username and password to access the API.

In the request Authorization tab, select Basic Auth from the Type dropdown list.

  • Enter your API username and password in the Username and Password fields.
  • For extra security, store these in variables.
Screenshot-2023-12-02-233529

Basic Auth



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads