How can we authenticate a user using Microsoft Azure ROPC (Resource owner password credentional)

309 Views Asked by At

I want to authenticate user using Microsoft graph azure (ROPC) but i got some error . I think that there is some issue during azure app setting. all error which i face are given below enter image description here

or when I use other email address then I got "email hidden error" enter image description here

2

There are 2 best solutions below

1
Bowman Zhu-MSFT On

Immediately after a successful request, the client should securely release the user's credentials from memory. It must never save them.

POST {tenant}/oauth2/v2.0/token
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&scope=user.read%20openid%20profile%20offline_access
&[email protected]
&password=SuperS3cret
&grant_type=password
0
RahulKumarShaw On

According to your image 1:

AADSTS65001: The user or administrator has not consented to use the application

The error occurs due to not given Grant consent permission to the application.

If your application user needs consent, you have to construct the consent URL

https://login.microsoftonline.com/{tenant-id}/adminconsent?client_id={client-id}

you can solve the issue and add the consent permission in the portal:

Go to azure portal:

AzureAAD->Enterprise App->security->Permission->Click the add grant admin consent for microsoft.

enter image description here

enter image description here

consider the permission of application needs, click the grant admin consent permission if you accept the application's request for certain rights.

According to your image 2:

AADSTS50034: The user account {EmailHidden} does not exist in the domain.onmicrosoft.com

This error occurs due to if your company domain has not been registered as a verified domain within your Azure AD tenant you will get an "invalid user name or password error."

For more information refer this SO thread