Skip to content
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

Use only code response type and drop implicit grant [SDK-2899] #538

Merged
merged 6 commits into from
Nov 9, 2021

Conversation

Widcket
Copy link
Contributor

@Widcket Widcket commented Nov 5, 2021

Changes

⚠️ THIS PR CONTAINS BREAKING CHANGES

The responseType(_:) and usingImplicitGrant() methods from Web Auth were removed, along with the ResponseType enum and the ImplicitGrant struct.
Now the code response type is hardcoded and cannot be changed.

Testing

The changes have been tested manually, by performing Web Auth login and logout in test apps, as follows:

Using Cocoapods

  • iOS 15.0 (simulator)
  • macOS 11.6.1
  • macOS 11.6.1 Catalyst

Using Carthage

  • iOS 15.0 (simulator)
  • macOS 11.6.1
  • macOS 11.6.1 Catalyst Carthage does not support building XCFrameworks for macCatalyst

Using SPM

  • iOS 15.0 (simulator)
  • macOS 11.6.1
  • macOS 11.6.1 Catalyst
  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@Widcket Widcket requested a review from a team as a code owner November 5, 2021 21:27
@Widcket Widcket added the review:small Small review label Nov 5, 2021
@Widcket Widcket marked this pull request as draft November 5, 2021 21:27
@Widcket Widcket changed the title Use only code response type and drop implicit grant Use only code response type and drop implicit grant [SDK-2899] Nov 5, 2021
case missingResponseParam(String)
case invalidIdTokenNonce // TODO: Remove on the next major
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one stopped being used when the ID Token validation was implemented, adding errors of its own.

entries["response_type"] = self.responseType.map { $0.label! }.joined(separator: " ")
entries["nonce"] = nonce
entries["organization"] = organization
entries["invitation"] = invitation
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really necessary to have if let organization = organization... to add optional values (value that may be nil). If it's nil, Swift won't add anything to the dictionary.
It's only necessary in the case of maxAge because it needs to be converted to String first, and for that, it must not be optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Widcket Widcket marked this pull request as ready for review November 8, 2021 18:20
.start(onAuth)
}

@IBAction func startIDTokenGoogleOAuth2(_ sender: Any) {
Auth0.webAuth()
.logging(enabled: true)
.connection("google-oauth2")
.responseType([.idToken])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to remove all these functions?

Copy link
Contributor Author

@Widcket Widcket Nov 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? That is the playground app

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support IDToken, CodeIDToken etc. so why include them in the playground app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch. The playground app needs some work anyway, but I'll change the name of some of the methods and remove others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 96d4927. Note that it still needs work.

@Widcket Widcket merged commit 95ac7a7 into beta Nov 9, 2021
@Widcket Widcket deleted the v2/drop-response-type branch November 9, 2021 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants