Tushar Patel
Tushar Patel

Reputation: 365

How to expires the ember-simple-auth session?

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.

Upvotes: 2

Views: 1807

Answers (1)

marcoow
marcoow

Reputation: 4062

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.

Upvotes: 2

Related Questions