0

My ADB2C created login page redirects to SPA after successful authentication and has an access token as URL parameter in the redirect URL. First, I want to extract an access token from a URL. Is this possible? And second, I want to store the extracted access token in localstorage. Is this also possible? Once these two are in place, I would expect the SPA to be able to access the backend API using an access token. thank you.

Pepe
  • 39
  • 6
  • You should rely on the client libraries like `msal.js` or `msal-angular` [based on your client side framework], rather than you trying to access or store the token yourself. – Anand Sowmithiran Mar 25 '22 at 09:33

1 Answers1

0

To get access token from URL make use of Postman.

  • In Postman, Open & switch to Authorization tab
  • Select OAuth 2.0 from the Type dropdown
  • In Grant type dropdown, select Authorization Code
  • In callback Url, enter your redirect Url
  • In Auth Url, enter your Authorize Url
  • In Access toke Url, enter your token Url
  • Enter your client ID and enter scope.
  • click the Get New Access Token button.
  • And this will generate access token.

For more in detail, please refer these links:

Obtaining an Access Token from Azure B2C using OAuth2.0 Authorization Code with PKCE in POSTMAN (vmsdurano.com).

Request Access Token in Postman for Azure AD B2C - Stack Overflow.

Imran
  • 3,875
  • 2
  • 3
  • 12