Disable bearer header for refresh-token request

This commit is contained in:
SleepWalker
2016-12-12 22:07:49 +02:00
parent b017147359
commit 7374ac3564
4 changed files with 77 additions and 10 deletions

View File

@@ -1,6 +1,9 @@
/**
* Applies Bearer header for all requests
*
* req.options.token is used to override current token.
* Pass null to disable bearer header at all
*
* @param {object} store - redux store
* @param {function} store.getState
*
@@ -13,7 +16,7 @@ export default function bearerHeaderMiddleware({getState}) {
let {token} = accounts.active ? accounts.active : user;
if (req.options.token) {
if (req.options.token || req.options.token === null) {
token = req.options.token;
}

View File

@@ -86,7 +86,8 @@ const authentication = {
requestToken(refreshToken) {
return request.post(
'/api/authentication/refresh-token',
{refresh_token: refreshToken}
{refresh_token: refreshToken}, // eslint-disable-line
{token: null}
).then((resp) => ({
token: resp.access_token
}));