Azure Active Directory Token Get after Login

Kevin Azure 141 Reputation points
2020-01-08T18:54:46.473+00:00

Hi Experts,

I have an Angular App, registered with an App Service, authentication enabled through OOTB Azure Portal > Authentication Blade > Express Settings (not through code)

Enabeld ID Token & Access Token for "App Reg 1".

When launched, the authentication prompt & login is happening.

How can I get the Token after login?

(is there any URL to call)

Can I reuse this Token for calling API with same Token in header which is also protected with same "App Reg 1"?

Please advice.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,473 questions
0 comments No comments
{count} votes

Accepted answer
  1. soumi-MSFT 11,716 Reputation points Microsoft Employee
    2020-01-08T20:07:36.763+00:00

    @PaulAzure-8925, The most important thing to keep in mind when implementing Azure AD authentication using OAuth2.0

    Which type of Auth Flow you would like to use?

    Ans: Mostly people use either the Authorization Code Grant Flow or Implicit Flow of OAuth2.0 to acquire an Access Token which can be used by the application to make further api calls or access resources. In case of Single Page Apps, mostly Implicit flow is used and for Asp .net or .net core, Java etc usually uses Authorization Code Grant Flow.

    Azure AD has two main endpoints which utilizes OAuth2.0:

    • /authorize ---> This endpoint provides the the authentication page[to enter the username and password] and returns the "code" or "id-Token" or both as per the request sent.
    • /token ---> Once the dode is received from the previous endpoint, its posted on to the "/token" endpoint to get an Access Token.

    More on these OAuth2.0 flows can be found here.

    Now coming to the second query of yours "Can I reuse this Token for calling API with same Token in header which is also protected with same "App Reg 1" ?"
    Yes, you can use the same access token multiple times [until the access token expires] to request for the same resource. As an access token is always issued for a particular resource. for eg: You request for an access token for Graph Api then, you can use this access token [for 1hr] and make multiple Graph API calls

    You can also check the following samples:

    Hope this helps.

    ---------------------------------------------------------------------------------------------------------------------------------------

    Please take a moment to "Mark as Answer" and/or "Vote as Helpful" wherever applicable. Thanks!


0 additional answers

Sort by: Most helpful