Unable to access the access code and refresh token of AAD Microsoft App

情到浓时终转凉″ 提交于 2020-05-17 07:03:20

问题


I'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"
}


回答1:


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.



来源:https://stackoverflow.com/questions/61465379/unable-to-access-the-access-code-and-refresh-token-of-aad-microsoft-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!