Skip to content

Commit

Permalink
FIX: Less greedy regex for token
Browse files Browse the repository at this point in the history
  • Loading branch information
nicedexter committed May 7, 2020
1 parent 0442d44 commit ee202a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/API/RequestHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import * as dotenv from 'dotenv';
dotenv.config();

const XSRFToken = (cookie: string) => {
const tokenArray = cookie && cookie.match(/XSRF-TOKEN=(.*)/);
const tokenArray =
cookie &&
cookie.match(/XSRF-TOKEN=([a-f\d]{8}(-[a-f\d]{4}){3}-[a-f\d]{12}?)/);
const token = (tokenArray && tokenArray[1]) || '';

return token;
Expand Down

0 comments on commit ee202a3

Please sign in to comment.