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

Enable WebAuth Logout for Android & Fix iOS Logout. #223

Merged
merged 2 commits into from
Jul 12, 2019

Conversation

lbalmaceda
Copy link
Contributor

@lbalmaceda lbalmaceda commented Jul 2, 2019

Changes

This PR enables the clear session feature for Android and fixes it for iOS.

When this is merged, it will always send the client_id and the returnTo parameters when opening the Auth0 logout URL.

Devs would need to whitelist the returnTo URL in the "Allowed Logout URLs" section of their application's settings in the Auth0 dashboard. Fail to do so will show an error page when the redirect is attempted.

Sample usage:

auth0.webAuth
   .clearSession({})
   .then(success => {
       //Logged out!
    })
    .catch(error => {
       //Browser closed by the user.
     });

Breaking changes?

At first, seems to only affect iOS only (because Android was disabled!). But if we look deeper, the current behavior is to open the logout URL without passing any returnTo nor clientId values. Testing this in an iOS simulator resulted in a browser showing the text "OK" and not redirecting back to the app. So even if the log out was successful, I had to manually close the browser in order to get back to the app.

With the changes introduced in this PR, users will either face the "URL not whitelisted" screen when there's a dashboard configuration error or return successfully to the app after logging out.

Current iOS behavior:

http://recordit.co/TQqX1AyApp

iOS behavior after this PR:

http://recordit.co/gWa1dlR8Zp

Android behavior after this PR:

http://recordit.co/GcPBbvQeNh

Testing

  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@lbalmaceda lbalmaceda requested review from a team and cocojoe and removed request for a team July 2, 2019 21:32
@lbalmaceda lbalmaceda added the small This PR may require low effort to action, or contains few changes to review label Jul 2, 2019
@lbalmaceda lbalmaceda changed the title Enable WebAuth Logout for Android Enable WebAuth Logout for Android & Fix iOS Logout. Jul 3, 2019
@stevehobbsdev stevehobbsdev self-requested a review July 8, 2019 12:33
Copy link
Contributor

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

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

LGTM

Quick question but why when you log out using iOS does the dialog say "..wants to use Auth0 to Sign In"? It's just a bit jarring.

@lbalmaceda
Copy link
Contributor Author

@stevehobbsdev I think that's how iOS behaves when trying to open a link from the app. @cocojoe can you clarify that, please?

@damieng
Copy link
Contributor

damieng commented Jul 12, 2019

Force-merging as codecov is having issues again.

@damieng damieng merged commit c3eeaa7 into master Jul 12, 2019
@bneigher
Copy link

bneigher commented Jul 15, 2019

@cocojoe @lbalmaceda
Guys, the "..wants to use Auth0 to Sign In" when using clearSession is preventing me from using the method. It's really weird to see that when a user chooses to logout.
Is there something I am missing that needs to be set up to skip that dialog?

A shot in the dark - but is there any way to clear any previous sessions (or do whatever clearSession does with your services) whenever a user attempts to login? (Or provide it as a flag to authorize) That way at least the web navigation permission dialog only shows up when you're attempting to log in. I don't see what side effects could possibly occur by doing this - and it makes for a way better UX.

@cocojoe
Copy link
Member

cocojoe commented Jul 15, 2019

@bneigher Although I totally agree it isn't the most beautiful experience. This behaviour is part of Apple's functionality for the recommended way to implement Auth flow, the only way to clear the cookies is by using the same flow so the correct cookie jar is used. So the dialog will be presented and there is no way to disable it.

However, be great for you to feedback on this at https://auth0.com/feedback

@lbalmaceda lbalmaceda modified the milestones: v1-Next, v1.5.0 Jul 15, 2019
@lbalmaceda lbalmaceda deleted the webauth-logout-android branch July 15, 2019 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Changed small This PR may require low effort to action, or contains few changes to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants