Skip to content

Commit

Permalink
change access token's scope
Browse files Browse the repository at this point in the history
  • Loading branch information
craigrbarnes committed Jan 30, 2025
1 parent 4391f4b commit ee89a8f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/src/features/gen3/gen3Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ export const gen3Api = createApi({
prepareHeaders: (headers, { getState }) => {
const csrfToken = selectCSRFToken(getState() as CoreState);
headers.set('Content-Type', 'application/json');

let accessToken = undefined;
if (process.env.NODE_ENV === 'development') {
// NOTE: This cookie can only be accessed from the client side
// in development mode. Otherwise, the cookie is set as httpOnly
accessToken = getCookie('credentials_token');
const accessToken = getCookie('credentials_token');
if (accessToken) headers.set('Authorization', `Bearer ${accessToken}`);
}
if (csrfToken) headers.set('X-CSRF-Token', csrfToken);
if (accessToken) headers.set('Authorization', `Bearer ${accessToken}`);

return headers;
},
}),
Expand Down

0 comments on commit ee89a8f

Please sign in to comment.