Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Update auth token header format
Browse files Browse the repository at this point in the history
  • Loading branch information
tdemin committed Jan 16, 2020
1 parent 2bb047d commit fd9b755
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/actions/auth.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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}`;
};

/**
Expand Down

0 comments on commit fd9b755

Please sign in to comment.