Share via

"AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token

Nelson Nwajie 5 Reputation points
2025-10-09T10:46:43.3133333+00:00

i get the error "AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token when i try to retreive my token.

I run an opensearch instance on an onprem server and i use entra id as my IDP, everything was working fine until yesterday when i couldnt authenticate with openid anymore, i get not authorized error on the opensearch side after authentication. seems like an empty token is returned. My attempt to get the token has proved abortive, this is the error i get all the time. it seems to me that is what been returned from entraid to opensearch

{"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. Trace ID: xxxxxxxxxxxx Correlation ID: xxxxxxxxxxxxxxxxxxxxx Timestamp: 2025-10-09 10:34:01Z","error_codes":[54005],"timestamp":"2025-10-09 10:34:01Z","trace_id":"d1e7f3e3-981c-4600-8d74-004c213a3d00","correlation_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}

i need help, as my team is totally blocked!

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Your answer

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