From fd9b755dee1d08fcc753a43047e90e98551907ed Mon Sep 17 00:00:00 2001 From: Timur Demin Date: Thu, 16 Jan 2020 15:39:59 +0500 Subject: [PATCH] Update auth token header format --- src/actions/auth.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/actions/auth.ts b/src/actions/auth.ts index d41b8eb..63f5bb7 100644 --- a/src/actions/auth.ts +++ b/src/actions/auth.ts @@ -7,7 +7,8 @@ import { AuthAction } from "../typings/actions"; import { serializeAuthData } from "../helpers/api"; import { SuccessAction, FailAction } from "../typings/api"; -const tokenHeader = "X-Auth-Token"; +const tokenHeader = "Authorization"; +const tokenPrefix = "Bearer"; /** * Redux action creator. Performs an HTTP request, if it succeeds, copies @@ -78,7 +79,7 @@ export const signup = ( * @param token Auth token in plain text. */ export const setToken = (token: string) => { - req.defaults.headers.common[tokenHeader] = token; + req.defaults.headers.common[tokenHeader] = `${tokenPrefix} ${token}`; }; /**