Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "refresh token" functionality to retrieve new tokens #5

Open
mrsheepuk opened this issue Dec 7, 2015 · 2 comments
Open

Add "refresh token" functionality to retrieve new tokens #5

mrsheepuk opened this issue Dec 7, 2015 · 2 comments

Comments

@mrsheepuk
Copy link
Owner

Glaring security hole with the code here means that if anyone compromises a single active token, they could remain logged in forever, even if the user changed their password or "logged out".

To fix this, refresh tokens must be implemented, which can be revoked.

@SHAliakbari
Copy link

Could you provide an example of implementing refresh token .
I followed the link you provide but i can not figure it out .

@mrsheepuk
Copy link
Owner Author

I've not had the need to implement it yet, but the basic concept is you generate a long-lived token which can only be used to request new tokens, not for direct access to the API. The long-lived token will be verified when you access the token-request end-point against revocation data from your underlying data source, before generating a new short-lived token which can then be used to access all your API end-points (which then don't need to check revocation data in your data source).

It's particularly important in the case of an app on a phone, where typically you log in once after installing the app then never again, therefore have a token of some sort which is valid indefinitely. It's less important on a website where you can simply choose to expire logins after a given period and have the user re-log-in. It depends on your use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants