Skip to content
Snippets Groups Projects
Commit f2b94e99 authored by Ramesh Kumar's avatar Ramesh Kumar
Browse files

TMSS-1228: Added X-CSRFTOKEN to request headers

parent b3588eea
Branches
Tags
1 merge request!657TMSS-1228: Added X-CSRFTOKEN to request headers
......@@ -18,7 +18,7 @@ const Auth = {
user = JSON.parse(user);
return Auth.getUserPermission(user);
} else {
//Keycloak authendication
//Keycloak authentication
const res = await AuthService.getKeycloakAuthState();
if (res && res.is_authenticated) {
localStorage.setItem("loginType", 'Keycloak');
......@@ -28,7 +28,7 @@ const Auth = {
return prev;
}, {});
const userDetails = {'name':res.username, 'token': cookies.csrftoken};
axios.defaults.headers.common['Authorization'] = `Token ${cookies.csrftoken}`;
// axios.defaults.headers.common['Authorization'] = `Token ${cookies.csrftoken}`;
localStorage.setItem("user", JSON.stringify(userDetails));
return Auth.getUserPermission(userDetails);
}
......@@ -39,6 +39,7 @@ const Auth = {
getUserPermission: async (user) => {
if (user.token) {
axios.defaults.headers.common['Authorization'] = `Token ${user.token}`;
axios.defaults.headers.common['X-CSRFTOKEN'] = `${user.token}`;
const permissions = await AuthStore.getState();
if(!permissions.userRolePermission.project) {
await PermissionStackUtil.getPermissions(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment