From e370fbe5007c715c994fbc8716fa193d4e2dc3bb Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 29 Jan 2019 09:05:45 +0000 Subject: [PATCH] fix: enable external auth by using a different header (#87) License: MIT Signed-off-by: Henrique Dias --- src/api/files.js | 2 +- src/api/utils.js | 2 +- src/utils/auth.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/files.js b/src/api/files.js index 00d16339..602090c1 100644 --- a/src/api/files.js +++ b/src/api/files.js @@ -88,7 +88,7 @@ export async function post (url, content = '', overwrite = false, onupload) { return new Promise((resolve, reject) => { let request = new XMLHttpRequest() request.open('POST', `${baseURL}/api/resources${url}?override=${overwrite}`, true) - request.setRequestHeader('Authorization', `Bearer ${store.state.jwt}`) + request.setRequestHeader('X-Auth', store.state.jwt) if (typeof onupload === 'function') { request.upload.onprogress = onupload diff --git a/src/api/utils.js b/src/api/utils.js index b2f1e931..617e2258 100644 --- a/src/api/utils.js +++ b/src/api/utils.js @@ -10,7 +10,7 @@ export async function fetchURL (url, opts) { const res = await fetch(`${baseURL}${url}`, { headers: { - 'Authorization': `Bearer ${store.state.jwt}`, + 'X-Auth': store.state.jwt, ...headers }, ...rest diff --git a/src/utils/auth.js b/src/utils/auth.js index 1516175a..ae050ba3 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -55,7 +55,7 @@ export async function renew (jwt) { const res = await fetch(`${baseURL}/api/renew`, { method: 'POST', headers: { - 'Authorization': `Bearer ${jwt}`, + 'X-Auth': jwt, } })