Skip to content

[Bug] Don't call HandleCodeRedemption twice in TokenAcquisition.cs#L125-L128 #246

Closed

Description

Which Version of Microsoft Identity Web are you using ?
Microsoft Identity Web 0.1.5-preview

**Where is the issue?

*In

// As AcquireTokenByAuthorizationCodeAsync is asynchronous we want to tell ASP.NET core that we are handing the code
// even if it's not done yet, so that it does not concurrently call the Token endpoint. (otherwise there will be a
// race condition ending-up in an error from Azure AD telling "code already redeemed")
context.HandleCodeRedemption();
, verify that we still need to handle the code redemption twice. This should not be needed and is the sign smell like someone is using async void.

Why is it so?
We had many cases, in the past, where the code was redeemed twice (once by Microsoft.Identity.Web and once by ASP.NET Core), which is not allowed by Azure AD.
However, async should ensure that this works fine.

What to do?
If this bugs, then the bug needs to be fixed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions