lundi 2 août 2021

ember-simple-auth user stays logged in despite browser relaunch

For some reason my user is still logged in despite closing my Safari browser.

These are the versions of Ember & stuff that I'm using:

ember-cli: 3.25.3
node: 14.16.0
os: darwin x64

This is my authentication code:

this.session.authenticate('authenticator:devise', this.fields.email, this.fields.password)

And this is my app/services/session.js file:

import { inject as service } from '@ember/service';
import BaseSessionService from 'ember-simple-auth/services/session';

export default class SessionService extends BaseSessionService {
  @service currentUser;

  async handleAuthentication(routeAfterAuthentication) {
    try {
      await this.currentUser.load();
      super.handleAuthentication(...arguments);
    } catch(err) {
      await this.invalidate();
    }
  }
}

and I'm checking my logged in status via:

this.session.isAuthenticated

It says here https://ember-simple-auth.com/api/classes/CookieStore.html that:

By default the cookie session store uses a session cookie that expires and is deleted when the browser is closed.

So how come my user is still authenticated despite closing my browser - any ideas or suggestions?




Aucun commentaire:

Enregistrer un commentaire