Skip to content

Commit

Permalink
fix: fix setUserToken issues (#528)
Browse files Browse the repository at this point in the history
fixes #278
  • Loading branch information
pi0 authored Mar 2, 2020
2 parents fb63f6f + 5d726b6 commit 02d14ac
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/schemes/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,11 @@ export default class LocalScheme {
}

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

if (this.options.tokenRequired) {
const token = this.options.tokenType
? this.options.tokenType + ' ' + tokenValue
: tokenValue

this.$auth.setToken(this.name, token)
this._setToken(token)
}
const token = this.options.tokenType
? this.options.tokenType + ' ' + tokenValue
: tokenValue
this.$auth.setToken(this.name, token)
this._setToken(token)

return this.fetchUser()
}
Expand Down

0 comments on commit 02d14ac

Please sign in to comment.