I'm trying to get access token but I keep getting this error
AADSTS900144: The request body must contain the following parameter: 'grant_type'
I tried it this way
body:
client_id=${CLIENT_ID_OUTLOOK}&grant_type=authorization_code&scope=user.read user.email&client_secret=${CLIENT_SECRET}&redirect_uri=http://localhost:3000/candidate/profile
,
and this way
{
grant_type: "authorization_code ", scope: "user.read user.email", client_id: CLIENT_ID_OUTLOOK, client_secret: CLIENT_SECRET, redirect_uri: "http://localhost:3000/candidate/profile"
, }
P.S: I am using react.
I need help please
@Olasumbo Eniola
• Looks like this is an encoding issue and you need to use the header:
'Content-Type': 'application/x-www-form-urlencoded'
https://gist.github.com/milon87/109c9263821c0c4bac959ce1b4c3357c
https://stackoverflow.com/questions/35325370/how-do-i-post-a-x-www-form-urlencoded-request-using-fetch
Yes, It worked! Thank you so much.
I have more questions regarding the API as I am still stuck with some other errors.
Would you be able to help me with them please? I would be glad.
@Olasumbo Eniola
• Thank you for the confirmation. I have converted my comment to answer, kindly
accept the answer
, so that others facing this problem can locate the solution quickly.
Feel free to post a new question for the other issue and tag me in the question.