ember-simple-auth
ember-simple-auth copied to clipboard
Allow access tokens to be refreshed to gain new rights
Access tokens are bearer tokens, so they contain the information regarding what this user is allowed to do.
Scenario:
- Administrator increases the rights of the logged in user.
- User has to wait until the access token expires (which is invisible to them) to get the new rights
User should be able to refresh their rights, under the hood calling
this.session.refreshToken
Of course some authentication methods don't use bearer tokens, so this would be meaningless in those cases.
Better:
this.session.authenticator.refreshToken
All ember-simple-auth needs to do is to make the authenticator object a public property of the session service.
I need to do this as well, is there any activity here? My use case is the exact same as @BryanCrotaz where a user has certain claim data updated and I need a way to get a fresh token.
Was able to get it working but would still be nice if refreshToken() were available on the service:
// refresh the access token.
const auth = getOwner(this).lookup('authenticator:jwt');
const { token } = this.session.session.content.authenticated;
auth.refreshAccessToken(token, 0);