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

feat(oauth): support Sign in with Apple by default + support postMessage API in InAppBrowser as available #374

Merged
merged 2 commits into from
Oct 16, 2019

Conversation

booleanbetrayal
Copy link
Collaborator

@@ -347,7 +348,7 @@ angular.module('ng-token-auth', ['ipCookie'])
buildAuthUrl: (omniauthWindowType, provider, opts={}) ->
authUrl = @getConfig(opts.config).apiUrl
authUrl += @getConfig(opts.config).authProviderPaths[provider]
authUrl += '?auth_origin_url=' + encodeURIComponent($window.location.href)
authUrl += '?auth_origin_url=' + encodeURIComponent(opts.auth_origin_url || $window.location.href)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apple does not support localhost domains for redirect as part of their OAuth implementation. This has practical implications when doing things in WKWebView proxied environments, where internal URLs are all localhost-based. This opts flag provides an escape hatch for a scenario such as this.

# favor InAppBrowser postMessage API if available, otherwise revert to returning directly via
# the executeScript API, which is known to have limitations on payload size
remoteCode = "
function performBestTransit() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Backwards-compatible change with DTA InAppBrowser handling. Check to see if the new authWindow implementation supports the cordova-in-app-browser's postMessage implementation, and if so, prefer that. executeScript has some limitations in payload size that may otherwise cause silent failures.

If the postMessage API is available, we will utilize our existing callback handler to retrieve the data.

If the postMessage API implementation is not available, default to returning the data directly through executeScript, as it did previously.

@booleanbetrayal booleanbetrayal changed the title feat(oauth): support Sign in with Apple by default + support postMessage API in InAppBrowser if available feat(oauth): support Sign in with Apple by default + support postMessage API in InAppBrowser as available Oct 16, 2019
@nbrustein
Copy link
Contributor

Changeset looks good to me.

@booleanbetrayal booleanbetrayal merged commit 49306c2 into lynndylanhurley:master Oct 16, 2019
@booleanbetrayal booleanbetrayal deleted the apple_provider_support branch October 16, 2019 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants