Skip to content

Commit

Permalink
Logout locally before logging in (nuxt-community#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantic-git committed Apr 18, 2018
1 parent 34d539e commit 198642a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/schemes/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default class LocalScheme {
return
}

// Ditch any leftover local tokens before attempting to log in
await this._logoutLocally()

const result = await this.$auth.request(
endpoint,
this.options.endpoints.login
Expand Down Expand Up @@ -81,6 +84,10 @@ export default class LocalScheme {
}

// But logout locally regardless
return this._logoutLocally()
}

async _logoutLocally () {
if (this.options.tokenRequired) {
this._clearToken()
}
Expand Down

0 comments on commit 198642a

Please sign in to comment.