使用 Ember 简单验证通过自定义验证器注销用户

Logging out a user with Custom Authenticator using Ember Simple Auth

我有一个与 Ember Simple Auth (1.0.1) 附加组件一起使用的自定义身份验证器。要注销用户,我在会话对象上调用 invalidate() 。如文档所述,我还解决了自定义身份验证器的无效方法中的承诺,如下所示:

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

阅读有关我的自定义身份验证器扩展的基本身份验证器的无效方法的文档,我希望会话删除本地存储(这是会话数据的默认存储)中的所有数据。但是,在按照我所说的解决承诺后,我仍然看到本地存储数据在使会话无效后仍然存在,这导致会话未失效。

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

我需要实际清除本地存储,还是需要导入 localStorageStore 并使用其 clear() 方法?

谢谢!

Ember Simple Auth 将清除会话存储区 authenticated 部分中的所有数据。这是验证器在验证会话时获取的所有数据。所有其他会话数据将保留在会话中,必须手动清除。