From c64e7f19c85afa01ca9587278579a5673e0aa2b0 Mon Sep 17 00:00:00 2001 From: Tony BRIET Date: Tue, 3 Apr 2018 12:32:14 +0200 Subject: [PATCH 1/2] fix(local-scheme-token): removed token type from axios setToken fixes #113 --- lib/schemes/local.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/schemes/local.js b/lib/schemes/local.js index 76ace294e..1321aef3a 100644 --- a/lib/schemes/local.js +++ b/lib/schemes/local.js @@ -9,7 +9,7 @@ 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.options.tokenType) + this.$auth.ctx.app.$axios.setToken(token) } } From 6cd2ab582e485878db37d829fbb1129e521de355 Mon Sep 17 00:00:00 2001 From: Tony BRIET Date: Tue, 3 Apr 2018 12:32:53 +0200 Subject: [PATCH 2/2] tests(local-scheme-token): add tests to check if Authorization Header is a valid Bearer format --- test/module.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/module.test.js b/test/module.test.js index a8a894e44..5f2a1ca5d 100644 --- a/test/module.test.js +++ b/test/module.test.js @@ -53,6 +53,8 @@ describe('auth', () => { }) expect(axiosBearer).toBeDefined() + expect(axiosBearer.split(' ')).toHaveLength(2) + expect(axiosBearer.split(' ')[0]).toMatch(/^Bearer$/i) expect(token).toBeDefined() expect(user).toBeDefined() expect(user.username).toBe('test_username')