Commit 3d1dc1a2 authored by Matija Obreza's avatar Matija Obreza

Fix: Backend provides `expires_in` property not `exp`

parent 792ee493
Pipeline #7167 passed with stages
in 6 minutes and 48 seconds
......@@ -24,9 +24,9 @@ export default function checkAuthToken(req, res, dispatch) {
return checkAuthTokenRequest(req, dispatch)
.then((data) => {
console.log(`Setting cookie to expire in ${data.exp}ms from`, data);
res.cookie('access_token', data.access_token, { path: '/', maxAge: data.exp });
res.cookie('access_token', data.access_token, { path: '/', maxAge: data.exp || data.expires_in || /* 1hr */ 1000 * 60 * 60 });
if (data.authorities) {
res.cookie('authorities', JSON.stringify(data.authorities), { path: '/', maxAge: data.exp });
res.cookie('authorities', JSON.stringify(data.authorities), { path: '/', maxAge: data.exp || data.expires_in || /* 1hr */ 1000 * 60 * 60 });
} else {
res.clearCookie('authorities');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment