How to expires the ember-simple-auth session?

做~自己de王妃 提交于 2020-01-04 13:45:44

问题


I am using ember-simple-auth for authentication in my application. I have created my custom Authenticator. Upon successful authentication, the server returns the token and expire time which I store in session storage of simple-auth.

My question is how do I expires or invalidate this session based on the expire time set in the session?

I also need to invalidate the session on browser close event.

Thanks.


回答1:


You can simply call the session's invalidate method. To call that after the expiration time that your server returns you could setup a timer with Ember.run.later or use automatic token refreshing as defined in the OAuth 2.0 standard which Ember Simple Auth OAuth 2.0 supports out of the box.



来源:https://stackoverflow.com/questions/25788580/how-to-expires-the-ember-simple-auth-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!