Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(response) => {
commit('SET_TOKEN', response.data)
// Not adding expire to the cookie as we are making it a session cookie
// expire can ounly be quoted in days
Cookies.set(state.authmethod.cookiename, state.token.JWTToken, {secure: true, path: '/'})
params.callback.ok(response)
},
(response) => {
logout ({commit, state, dispatch}, params) {
if (isCookieSetFN()) {
// Note- remove cookie not working so we settle for blanking out the value and setting it to expire
Cookies.set(state.authmethod.cookiename, 'X', {secure: true, path: '/', expire: -1})
Cookies.set(state.authmethod.cookiename, '', {secure: true, path: '/', expire: -1})
Cookies.remove(state.authmethod.cookiename)
}
commit('SET_TOKEN', undefined)
params.callback.ok(undefined)
},
getJWT ({commit, state, dispatch}, params) {
logout ({commit, state, dispatch}, params) {
if (isCookieSetFN()) {
// Note- remove cookie not working so we settle for blanking out the value and setting it to expire
Cookies.set(state.authmethod.cookiename, 'X', {secure: true, path: '/', expire: -1})
Cookies.set(state.authmethod.cookiename, '', {secure: true, path: '/', expire: -1})
Cookies.remove(state.authmethod.cookiename)
}
commit('SET_TOKEN', undefined)
params.callback.ok(undefined)
},
getJWT ({commit, state, dispatch}, params) {
.then(resp => {
Cookies.set("user-token", resp.data.access);
commit(AUTH_SUCCESS, resp);
});
})
.then(resp => {
Cookies.set("refresh-token", resp.data.refresh);
Cookies.set("user-token", resp.data.access);
commit(AUTH_SUCCESS, resp);
dispatch(USER_REQUEST);
resolve(resp);
})
.catch(err => {
handler () {
Cookies.set('gdpr', true, { expires: 5 * 365 })
}
},
authSuccess: (state, payload) => {
Cookies.set("user-token-gql", payload.tokenAuth.token);
state.token = payload.tokenAuth.token;
},
};