User Authentication in Token Generation

Risa Shereen 71 Reputation points
2022-07-21T06:46:29.71+00:00
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. CarlZhao-MSFT 46,406 Reputation points
    2022-07-21T10:47:05.723+00:00

    Hi @Risa Shereen

    Depending on your context, I recommend you to use the auth code flow to authenticate the user and get the access token.

    First grant your application the UserAuthenticationMethod.ReadWrite.All delegated permission and grant admin consent.

    Then run the authentication URL in your browser and log in with your administrator (the admin needs one of the following Azure AD roles: Global administrator, Privileged authentication administrator or Authentication administrator) in the login page that pops up. After that you will get the authorization code in the browser address bar.

    https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/authorize?  
    client_id={client id}  
    &response_type=code  
    &redirect_uri={redirect_uri}  
    &response_mode=query  
    &scope=UserAuthenticationMethod.ReadWrite.All  
    &state=12345  
    

    Next redeem an access token with your authorization code in postman.

    223095-2022-07-21-183954.png

    Finally use the access token to call the graph api to reset the user password.

    223132-2022-07-21-184105.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.