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.
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.