Forum Discussion
Authenticate Microsoft graph API with username and password without register app
<Response [400]>
Authentication failed: 400
when I send the request via post method, I have re verified my passwords username and tenant id, everything is correct , any idea what could be the issue here ?
Hi chetan_sk,
thanks for the update.
I understand that you are getting a 400 error even though you have verified that your username, password, and tenant ID are correct.
Here are some additional things you can try to troubleshoot the issue:
- Make sure that you are sending the request with the correct headers. The Content-Type header should be set to application/x-www-form-urlencoded.
- Make sure that you are sending the request to the correct endpoint. The endpoint for the ROPC flow is https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token.
I also recommend that you try using the OAuth 2.0 authorization code flow or the client credentials flow to authenticate to the Microsoft Graph API. These flows are more secure and reliable than the ROPC flow.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- chetan_skOct 04, 2023Copper ContributorHi Leon, Addition to my previous comment, I even tried with postman thinking something must be blocked but same issue when I am trying to get tocken, is there any documentation regarding this way of authentication ?
"error": "invalid_request",
"error_description": "AADSTS90102: The 'resource' request parameter is not supported.- gauravjaini0001Dec 21, 2023Copper Contributor
chetan_sk - I am getting the same error. did you manege to find the solution?
- chetan_skOct 04, 2023Copper ContributorHi Leon,
The other two points which you mentioned are also in place and correct, We cannot go ahead with the client credentials at the moment.
Regarding the ROPC flow is there any other setting or permission needed to make this post method wotk ?