Stay home, protect yourself and everyone around you from COVID-19. For more information see -

Setting Azure AD B2C Authentication in Postman

Setting Azure AD B2C Authentication in Postman

Azure AD B2C has been so far good, mostly because of the 50k free user authentication 😇, also it just works. The problem I had using B2C with backend was acquiring and testing tokens in development.

Yes, Azure AD B2C has Resource Owner Password Credential (ROPC) flow that allows you to get tokens by just posting your username and password, but they don’t recommend it. Though, I have been using that locally to get the tokens.

With the new update of Postman (version 8+), it’s easy to set OAuth 2.0 based authentication.

So, let’s set it up.

Setup Azure AD B2C

Note: This article assumes that you have basic knowledge about OAuth 2.0 and Azure AD B2C

Before we get the tokens, we should tell Azure AD B2C that we want to authenticate using Authorisation code flow with Proof Key for Code Exchanged (PKCE).

At the time of writing this article, Azure AD B2C supports the following platforms:

  1. Web applications
    1. Web
    2. Single-page application
  2. Mobile and desktop application
    1. iOS/macOS
    2. Android
    3. Mobile and desktop application

For web applications you need client security code because as far as I have tested it, it doesn’t work with PKCE. I chose - Mobile and desktop application - because Postman is a desktop application. Let’s add a platform first:

  1. In Azure AD B2C directory, select - App registrations - from the left menu
  2. Under Owned applications tab, select your application.
  3. From the left menu, under Manage section, select Authentication
  4. Under - Platform configurations - click on Add a platform. This should open a drawer from right.
    Add a new platform

    Add a new platform

    select the - Mobile and desktop applications.
  5. According to their documentation, the callback URL should be -, add that and click Configure.
    Adding callback URL

    Adding callback URL

    This will create the appropriate platform.
  6. Also, in the same page, under Implicit grant and hybrid flows, make sure Access tokens and ID tokens are ticked.
    Enable grants

    Enable grants

Setup Postman

At this point make sure you know your endpoints for - authorize and token, mine is:

Let’s setup OAuth 2.0:

Go to collection setting, click on Authorization tab, and do the following:

Type Entry Description
Type OAuth 2.0 Type of authentication
Add auth data to Request Header Once an access_token is received, where do you want it to be placed

Configure New Token

Type Entry Description
Type Name Azure AD B2C Authentication This is up to you
Grant Type Authorization Code (With PKCE)
Callback URL This cannot be edited
Authorize using browser Tick
Auth URL{{$randomUUID}}&response_mode=query $randomUUID generate a UUID V4 and the response should be URL query
Access Token URL
Client ID <your client ID>
Client Secret This should be empty
Code Challenge Method SHA-256
Code Verifier This should be empty so that Postman can generate one for you
Scope <custom scope> openid profile offline_access
State {{$randomUUID}} $randomUUID generate a UUID V4
Client Authentication Send client credentials in body


Screenshot of Postman authentication setup

Screenshot of Postman authentication setup


These steps should be similar to other OAuth providers. Do give it a try and let me know if there is a space for improvements. I hope this article helps you in your development.


  • New callback URL added
Copyright © Akshay Raj Gollahalli's logo 2021