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

Facebook Login web page does not redirect to the application at the first login #51

Closed
iuliiazhelem opened this issue Sep 28, 2016 · 2 comments
Milestone

Comments

@iuliiazhelem
Copy link

At the first login to Facebook the redirect URL contains "fragment" _=_
For example
com.auth0.akswiftauth0test://juliazhelem.eu.auth0.com/ios/com.auth0.AKSwiftAuth0Test/callback?code=pMmrjQQO7EAQGJmt&state=pg76m1ep6TD0RwYzwrlszuh7bpXjwIBmaxW_NWacZCM#_=_

Auth0.swift analyzes this URL and marks it as “not completed” (Auth0.resumeAuth(url, options: options) returns "false")

For the next logins to Facebook the redirect URL does not contain any fragments and everything works fine

Possible solution:
Function SafariSession.resume(...) does not check "fragment", only "query".
So changing let items = components.a0_values to let items = components.a0_queryValues in file https://github.com/auth0/Auth0.swift/blob/master/Auth0/OAuth2Session.swift#L86 might fix the issue

iuliiazhelem added a commit to iuliiazhelem/Auth0.swift that referenced this issue Sep 28, 2016
At the first login to Facebook the redirect URL contains "fragment" _=_

auth0#51
@hzalaz
Copy link
Member

hzalaz commented Sep 28, 2016

Does it happen with all facebook logins? Not sure that's the proper fix

@iuliiazhelem
Copy link
Author

iuliiazhelem commented Sep 28, 2016

Only with the first login, I mean if you did not login to Facebook on your device before.
In this case URL contains #_=_ and Auth0.resumeAuth(url, options: options) returns "false" (https://github.com/auth0/Auth0.swift/blob/master/Auth0/OAuth2Session.swift#L87) because items are a0_fragmentValues (_, _). But the URL is correct, it contains all necessary information (state, code) in NSURL.query

Also I checked "twitter", "google-oauth2", "linkedin". State and code are in NSURL.query, for these connections URL does not contain NSURL.fragment at all.

https://auth0.com/forum/t/facebook-sign-in-page-doesnt-dismiss-on-first-try-ios/3796

@hzalaz hzalaz modified the milestone: 1.0.0 Oct 6, 2016
@hzalaz hzalaz closed this as completed Oct 6, 2016
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

No branches or pull requests

2 participants