Skip to content

Commit

Permalink
feat: add support for custom token key in request header (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored and pi0 committed Apr 20, 2018
1 parent b6cfad4 commit f7576e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/schemes/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export default class LocalScheme {
_setToken (token) {
if (this.options.globalToken) {
// Set Authorization token for all axios requests
this.$auth.ctx.app.$axios.setToken(token)
this.$auth.ctx.app.$axios.setHeader(this.options.tokenName, token)
}
}

_clearToken () {
if (this.options.globalToken) {
// Clear Authorization token for all axios requests
this.$auth.ctx.app.$axios.setToken(false)
this.$auth.ctx.app.$axios.setHeader(this.options.tokenName, false)
}
}

Expand Down Expand Up @@ -99,5 +99,6 @@ export default class LocalScheme {
const DEFAULTS = {
tokenRequired: true,
tokenType: 'Bearer',
globalToken: true
globalToken: true,
tokenName: 'Authorization'
}

0 comments on commit f7576e3

Please sign in to comment.