0
votes

enter image description hereI'm trying to automate the file transfer between one drive and Linux. Hence I need to generate the access token and refresh token.

My POST URL is

https://login.microsoftonline.com/common/oauth2/v2.0/token?grant_type='authorization_code'&client_id=XXXXXXXXXXXXXX&code=XXXXXXXXXXXXX

getting below error as below

{
    "error": "invalid_request",
    "error_description": "AADSTS9001442323: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: 55c2b449-381b-41844ads5a2f-b2b7-451d65188500\r\nCorrelation ID: bf082e8f-99be-41e0-87dd-756894601365\r\nTimestamp: 2020-04-27 17:54:21Z",
    "error_codes": [
        90043234144
    ],
    "timestamp": "2020-04-27 17:54:21Z",
    "trace_id": "55cadsasdad2b449-381b-412f-b2b7-451d65188500",
    "correlation_id": "bf0asdadada82e8f-99be-41e0-87dd-75688dasda94601365",
    "error_uri": "https://login.microsoftonline.com/error?code=90014486"
}

enter image description here

1

1 Answers

1
votes

You should specify application/x-www-form-urlencoded as the value of the header Content-Type. Then this error will not exist.

But based on your previous post, you have set the application/x-www-form-urlencoded. So if it's not the reason for this issue, please provide more details: Where are you generating the access token? In Postman? Could you provide a screenshot?

But there is another error. You should use grant_type=authorization_code instead of grant_type='authorization_code'.

And you should provide some other parameters. See this sample: Request an access token.