azureapimicrosoft-graph-apiazure-ad-b2cropc

How can we create a User Flow in Azure-ad-b2c for ROPC authentication and then how can we use it in postman or in laravel controller


Actually I have some issues related run a code for get a token from Microsoft graph API. Kindly guide me that how can I create a user flow with ROPC authentication and then how can we run it on postman or in Laravel controller to get a token. I tried it, but got some error. Image is attached for more clarity. Refer the image


Solution

  • You can follow this Set up a resource owner password credentials flow - Azure AD B2C | Microsoft Docs

    Create user flow in azuread b2c tenant. enter image description here

    Give some name and check the claims that need to be returned.

    enter image description here

    enter image description here

    I tested and got accesstoken and id token successfully in postman. Where i gave POST request to https://xxx.b2clogin.com/xx.onmicrosoft.com/oauth2/v2.0/token?p=b2c_1_ropcsignin (b2c_1_ropcsignin is the userflow policy name).

    enter image description here - You can copy the accessToken and decode in https://jwt.io or https://jwt.ms to see the user details and claims. I got the selected claims in my userflow.

    enter image description here

    EDIT:

    You can select the required claims under "Application claims" in step2

    enter image description here

    then if you decode the access token that you get after updating the selection, you can see the email of the user in token claims. enter image description here