Forum Discussion
GeraldoW
Dec 30, 2024Copper Contributor
Error: AADSTS54005: OAuth2 Authorization code was already redeemed
Hello,
I tested Azure Virtual Desktop Quickstart, all days long. When I want to login with Windows App oder Remote Desktop to the VM, I get always the same error:
--------------------
CAA20003
AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token.
--------------------
What's going wrong?
Thank you!
GeraldoW
- Ensure Single Use of Authorization Code:
- Authorization codes can only be used once. Make sure your application is not attempting to reuse the same authorization code. Instead, use the refresh token to obtain new access tokens.
- Check for Expired Client Secret:
- Verify that your client secret has not expired. You can do this by navigating to Azure AD > App registrations > Your application > Certificates & secrets. If the secret has expired, create a new one and update your application configuration.
- Review Application Code:
- Ensure your application is correctly handling the OAuth2 flow. After obtaining the authorization code, it should be exchanged for an access token immediately and not reused.
- Clear Cache and Retry:
- Sometimes, clearing the cache or cookies in your browser can help resolve this issue. Try logging in again after clearing the cache.
- Use a Different Redirect URI:
- If you are using a specific redirect URI, ensure it is correctly configured in your Azure AD app registration. Sometimes, using a different redirect URI for testing can help identify if the issue is related to the current URI configuration.