Hi, following the doc from CookieStore - ember-simple-auth i tried to change cookieExpirationTime but it still expire in one hour after login, here is my code :
//login.js
...
@tracked _rememberMe = false;
@action
async authenticate() {
try {
await this.session.authenticate('authenticator:oauth2', this.loginChangeset.email, this.loginChangeset.password, [this.selectedLoginOption]);
} catch (error) {
console.log('error ', error)
this.errorMessage = error.responseJSON.message;
this.notifications.error(this.errorMessage, {
autoClear: true,
});
} finally {
if (this.session.isAuthenticated) {
const me = await this.store.queryRecord('me', {});
console.log('me ', me);
// const expirationTime = 14 * 24 * 60 * 60;
// this.session.set('store.cookieExpirationTime', expirationTime);
this.session.set('data.user_type', me.typeModel);
}
}
}
@action
rememberMe(evt) {
this._rememberMe = !this._rememberMe;
console.log('set rememberMe ', this._rememberMe)
let expirationTime = this._rememberMe ? (14 * 24 * 60 * 60) : null;
this.session.set('store.cookieExpirationTime', expirationTime);
}
// app/session-stores/application.js
import CookieStore from 'ember-simple-auth/session-stores/cookie';
export default class ApplicationSessionStore extends CookieStore {}
i get this cookie
ember_simple_auth-session-expiration_time:"1209600000"
ember_simple_auth-session:{
authenticated:{
authenticator:"authenticator:oauth2"
token_type:"bearer"
expires_in:3600
scope:"create"
expires_at:1626431516189
....
}
}
ember_simple_auth-session-expiration_time is set to the right date , but when an hour is passed i am logged out automatically .
And from the api i get this header response with the right expiration date :
Set-Cookie jwt=...................................................;
Path=/;
Expires=Thu, 14 Oct 2021 09:51:14 GMT; HttpOnly
thank you.