Hello @김보람,
Thank you for posting your query on Microsoft Q&A.
Based on your description, it seems you are encountering the error message "AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token" when trying to access the application. This error indicates that the application is attempting to redeem the same authorization code more than once. Authorization codes are meant to be used only once; trying to reuse them will result in this error. Please initiate a new request to the /authorize endpoint to obtain a fresh authorization code.
If your app reuses authorization codes to get tokens for multiple resources, we recommend that you use the code to get a refresh token, and then use that refresh token to acquire additional tokens for other resources. Authorization codes can only be used once but refresh tokens can be used multiple times across multiple resources. Any new app that attempts to reuse an authentication code during the OAuth code flow will get an invalid_grant error.
For more information about refresh tokens, see Refreshing the access tokens.
You can capture the browser trace while accessing the application and compare the traces from both the working and non-working sessions to observe the behavior.
Capture a browser trace for troubleshooting
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.
Thanks,
Raja Pothuraju.