-
Notifications
You must be signed in to change notification settings - Fork 231
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
Remove parameterless tokenExchange()
method
#573
Conversation
Auth0/Auth0Authentication.swift
Outdated
@@ -360,6 +347,20 @@ private extension Auth0Authentication { | |||
telemetry: self.telemetry) | |||
} | |||
|
|||
func tokenExchange() -> Request<Credentials, AuthenticationError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you want to change these, but strictly speaking there's no "Token Exchange" going on with these defaults, you're just calling the "Get Token" endpoint https://auth0.com/docs/api/authentication#get-token
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the private method to just token()
after the endpoint in 8f5a656.
V2_MIGRATION_GUIDE.md
Outdated
@@ -97,6 +97,20 @@ Use `createUser(email:username:password:connection:userMetadata:rootAttributes:` | |||
|
|||
Use `userInfo(withAccessToken:)` instead. | |||
|
|||
#### `tokenExchange(withParameters:)` | |||
|
|||
Use `tokenExchange(withCode:codeVerifier:redirectURI:)` instead. To pass custom parameters, use the `parameters(_:)` method from `Request`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this should really be called codeExchange
- since you're doing Proof Key for Code Exchange (not sure what Android calls it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, renamed the method in 8f5a656.
Android calls it token()
.
Changes
Auth0.swift 1.x has a
tokenExchange(withParameters:)
method, besidestokenExchange(withCode:codeVerifier:redirectURI:)
. Since we addedRequest.parameters(_:)
and removed all the existingparameters:
parameters,tokenExchange(withParameters:)
ended up astokenExchange()
.Auth0.Android does not have a similar parameterless method, only
fun token(authorizationCode: String, codeVerifier: String, redirectUri: String )
, that is, the equivalent totokenExchange(withCode:codeVerifier:redirectURI:)
.Since we already have
tokenExchange(withCode:codeVerifier:redirectURI:)
, and given the fact developers can add custom parameters withRequest.parameters(_:)
, it does not make sense to keep the parameterlesstokenExchange()
method. This PR removes it.Testing
Checklist