feat(ios): support HTTPS callback URLs via ASWebAuthenticationSessionCallback (iOS 17.4+)#486
Open
brian-ouellette-cb wants to merge 1 commit into
Conversation
…Callback On iOS 17.4+, ASWebAuthenticationSession gained support for HTTPS Universal Link callbacks via ASWebAuthenticationSessionCallback. Previously, only custom URL schemes were supported for the redirect, which required registering a custom scheme and prevented use of standard HTTPS OAuth redirect URIs (e.g. for Universal Links / associated domains). This change detects when the redirectURL uses the https scheme and, on iOS 17.4+, creates an ASWebAuthenticationSessionCallback using callbackWithHTTPSHost:path: instead of passing a callbackURLScheme. Older iOS versions fall back to the existing custom scheme behavior.
Author
|
@jdnichollsc LMK what you think here, tested this working via local patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iOS 17.4 introduced
ASWebAuthenticationSessionCallback, which allowsASWebAuthenticationSessionto use HTTPS Universal Link URLs as OAuth redirect callbacks — not just custom URL schemes. This is important for apps using associated domains (e.g.https://example.com/oauth/callback) rather than custom schemes likemyapp://oauth/callback.What changed
redirectURLuses thehttpsscheme.ASWebAuthenticationSessionCallbackusingcallbackWithHTTPSHost:path:instead of passingcallbackURLScheme:.callbackURLSchemebehavior for custom URL schemes and for iOS < 17.4.All existing behavior for custom URL scheme redirects is preserved.
Why this matters
Apps that implement Universal Links for OAuth callbacks (required by some OAuth providers and increasingly expected by modern auth standards) were previously blocked from using
ASWebAuthenticationSessionthrough this library. With this change, an HTTPS redirect URI works end-to-end on iOS 17.4+.How it works
The compile-time
#if defined(__IPHONE_17_4)guard ensures the code compiles cleanly against SDKs older than 17.4.Possibly related issues
openAuthnot completing when the redirect URI is an HTTPS URL. Apps using an HTTPS redirect URI (e.g. a Dynamic Link or Universal Link) would benefit from this fix on iOS 17.4+.Test plan
callbackURLis returned correctly.callbackURLSchemeand no build errors.#if defined(__IPHONE_17_4)guard.