Grant type required

Olasumbo Eniola 26 Reputation points
2022-05-24T12:29:47.66+00:00

Hello,

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

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,048 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,810 questions
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,616 Reputation points
    2022-05-24T13:19:35.61+00:00

    @Olasumbo Eniola • Looks like this is an encoding issue and you need to use the header: 'Content-Type': 'application/x-www-form-urlencoded'

    Ref:

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.