asleroid
asleroid

Reputation: 3

Logging out a user with Custom Authenticator using Ember Simple Auth

I have a Custom Authenticator that I am using with the Ember Simple Auth (1.0.1) add-on. To log a user out, I call invalidate() on the session object. As documented, I also resolve the promise in the custom authenticator's invalidate method like so:

invalidate() {
    return RSVP.resolve();
 }

Reading the documentation on the invalidate method for the Base Authenticator that my custom authenticator extends, I expect the session to remove any data that was in local storage (which is the default storage for the session data). However, upon resolving the promise as told I still see the localstorage data persist after invalidating the session which causes the session to not be invalidated.

"This method returns a promise. A resolving promise will result in the session becoming unauthenticated." See http://ember-simple-auth.com/api/classes/BaseAuthenticator.html

Do I need to pragmatically clear the local storage, or do I need to import the localStorageStore and use its clear() method?

Thanks!

Upvotes: 0

Views: 126

Answers (1)

marcoow
marcoow

Reputation: 4062

Ember Simple Auth will clear all data in the authenticated section of the session store. This is all data acquired by the authenticator when authenticating the session. All other session data will remain in the session and would have to be manually cleared.

Upvotes: 1

Related Questions