Search code examples
azureazure-active-directorypowershell-2.0adalazure-ad-graph-api

How to access token through Powershell or Postman by User ID rather than Client ID


Is there a way either in powershell or Postman to get access of myself either through login to particular tenant. I see lot of samples around getting access token either client ID or secret. But I want to run either commands or make REST call to get access token once myself get authenticated.I tried looking into graph explorer but no luck .


Solution

  • The client id is required for AAD authorization.

    If you want to get an access token including your own information, you should implement OAuth 2.0 authorization code flow. It will perform interactive login as @Gaurav Mantri-AIS mentioned.

    We can simply get the access token in Postman like this:

    enter image description here

    enter image description here

    After clicking on "Request Token", it will pop up a login window. Enter your username and password. Then you will get the access token.

    When we log into Graph explorer, we will see the access token here: enter image description here

    In fact, Microsoft has registered an Azure AD application and provided the client id in the login request URL.

    In short, we have to use the client id.