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
You can follow this Set up a resource owner password credentials flow - Azure AD B2C | Microsoft Docs
Create user flow in azuread b2c tenant.
Give some name and check the claims that need to be returned.
user.read
and offline_access
scopes.application id
or client id to use in scopes .password
,scope as openid application-id offline_access
,client_id as application-id, response_type) in the body.
Highlighted are required ones as stated in document
test-the-ropc-flowI 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).
- 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.
You can select the required claims under "Application claims" in step2
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.