DominikAngerer/auth0-vue

Logout loop

Closed this issue · 1 comments

Thanks so much for putting this together! It's frustrating that all of the official docs I've tried to follow so far haven't worked.

One issue, I can't actually log out with the tutorial. It does delete from local storage, but then webAuth.authorize() fires and the user is logged in again.

To fix I needed to:

  1. Add a logout route in the Auth0 dashboard
  2. Change the logout function to be:
logout() {
  return new Promise((resolve, reject) => {
    localStorage.removeItem('access_token')
    localStorage.removeItem('id_token')
    localStorage.removeItem('expires_at')
    localStorage.removeItem('user')
    webAuth.logout({
      returnTo: 'http://localhost:8080/', // the logout route added to dashboard goes here
      clientID: '...', // same clientID in the constructor
    })
})

I don't know if you're still updating this, but I'd be happy to make a PR with those changes.

Strange that you got that issue - will add some tests. Feel free to add a PR and I will update the tutorial accordingly 👍