Skip to content

Commit

Permalink
fix(setUserToken): Add fallback to unimplemented strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Feb 7, 2019
1 parent 07fc1ad commit c4691ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/core/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ export default class Auth {
}

setUserToken (token) {
if (!this.strategy.setUserToken) {
this.setToken(this.strategy.name, token)
return Promise.resolve()
}

return Promise.resolve(this.strategy.setUserToken(token)).catch(error => {
this.callOnError(error, { method: 'setUserToken' })
return Promise.reject(error)
Expand Down

0 comments on commit c4691ab

Please sign in to comment.