Permalink
Browse files

feat: add support for custom token key in request header (#152)

  • Loading branch information...
farnabaz authored and pi0 committed Apr 20, 2018
1 parent b6cfad4 commit f7576e365edba64202c1263abaeea6f14c21b3f1
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/schemes/local.js
@@ -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)
}
}
@@ -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.