question

junxiang-2190 avatar image
0 Votes"
junxiang-2190 asked azure-cxp-api edited

54005 error

I use the https://login.microsoftonline.com//{tenant}/oauth2/v2.0/token API to obtain tokens. It has been running well, but recently it often appears intermittently inaccessible.
The error message is as follows:
{"error":"invalid_grant","error_description":"AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token.\r\nTrace ID: 01c12a0a-c622-48c2-90a0 -9c1d81488f00\r\nCorrelation ID: b1b1e359-6654-49dd-82a7-9be1bbdb48ed\r\nTimestamp: 2021-03-18 01:32:40Z","error_codes":[54005],"timestamp":"2021-03 -18 01:32:40Z","trace_id":"01c12a0a-c622-48c2-90a0-9c1d81488f00","correlation_id":"b1b1e359-6654-49dd-82a7-9be1bbdb48ed"}
What caused this? By the way, I am from China.

azure-active-directory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered

Make sure that you should call AcquireTokenByAuthorizationCodeAsync only once when you receive authorization code. Also you made need to call OAuth2 authorize endpoint with offline_access scope to get refresh token.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.