Renew accessToken by 30d in each access to Dashboard

This commit is contained in:
Gustavo Trott 2021-09-13 15:07:02 -03:00
parent 9b990b758a
commit d807436d10

View File

@ -47,6 +47,13 @@ class App extends React.Component {
cArr.forEach((val) => {
if (val.indexOf(`${cookieName}=`) === 0) learningDashboardAccessToken = val.substring((`${cookieName}=`).length);
});
// Extend AccessToken lifetime by 30d (in each access)
if (learningDashboardAccessToken !== '') {
const cookieExpiresDate = new Date();
cookieExpiresDate.setTime(cookieExpiresDate.getTime() + (3600000 * 24 * 30));
document.cookie = `learningDashboardAccessToken-${meetingId}=${learningDashboardAccessToken}; expires=${cookieExpiresDate.toGMTString()}; path=/;SameSite=None;Secure`;
}
}
this.setState({ learningDashboardAccessToken, meetingId }, this.fetchActivitiesJson);