Skip to content

OAuthHandler ExchangeCodeAsync signature change #14942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
halter73 opened this issue Oct 4, 2019 · 0 comments · Fixed by #15044
Closed

OAuthHandler ExchangeCodeAsync signature change #14942

halter73 opened this issue Oct 4, 2019 · 0 comments · Fixed by #15044
Assignees
Labels
breaking-change Indicates a .NET Core breaking change

Comments

@halter73
Copy link
Member

halter73 commented Oct 4, 2019

OAuthHandler ExchangeCodeAsync signature change

The signature of OAuthHandler.ExchangeCodeAsync was changed from:

protected virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Authentication.OAuth.OAuthTokenResponse> ExchangeCodeAsync(string code, string redirectUri) { throw null; }

To:

protected virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Authentication.OAuth.OAuthTokenResponse> ExchangeCodeAsync(Microsoft.AspNetCore.Authentication.OAuth.OAuthCodeExchangeContext context) { throw null; }

Version introduced

3.0

Old behavior

The code and redirectUri strings were passed as separate arguments.

New behavior

Code and RedirectUri are now properties on OAuthCodeExchangeContext that can be set via the OAuthCodeExchangeContext constructor. This new OAuthCodeExchangeContext type is now the only argument passed to OAuthHandler.ExchangeCodeAsync.

Reason for change

To flow additional parameters in a way that allows for similar non-breaking changes to be made in the future without adding new ExchangeCodeAsync overloads.

Recommended action

Construct an OAuthCodeExchangeContext with the appropriate code and redirectUri values. An AuthenticationProperties will also need to be passed in. This single OAuthCodeExchangeContext can then be passed to OAuthHandler.ExchangeCodeAsync instead of multiple arguments.

Category

ASP.NET Core

Affected APIs

OAuthHandler<TOptions>.ExchangeCodeAsync(string code, string redirectUri)


Issue metadata

  • Issue type: breaking-change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants