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

Infinite token #137

Open
jaimecuellar14 opened this issue Oct 17, 2018 · 4 comments
Open

Infinite token #137

jaimecuellar14 opened this issue Oct 17, 2018 · 4 comments
Labels

Comments

@jaimecuellar14
Copy link

I would like to know if there is a way to have an infinite token, so I dont have to refresh the expiration time.
Thanks.

@tuupola
Copy link
Owner

tuupola commented Oct 17, 2018

I think if you leave out the exp claim token will never expire.

@jaimecuellar14
Copy link
Author

jaimecuellar14 commented Oct 18, 2018

Just like this?

`$payload = [
            	"iat" => $now->getTimeStamp(),
            	"jti" => $jti,
            	"sub" => $server["PHP_AUTH_USER"]
        	];`

@thiagok
Copy link

thiagok commented Dec 5, 2018

Is this a good way to use? I mean, for me it's confuse to request user/pass to get a token every request for my api.

Can I generate an API Token for my user without exp and use for ever?

@ItsBasvanDam
Copy link

@thiagok Even if you technically could, I would argue that you should not. Think about it like this: if you provide a user with an infinitely lasting token, how would you remove access for that token in the future if you needed to? As far as I know, the only way would be to change your application secret, something that would impact all users by invalidating every single token.

Furthermore, I think there is no good reason to hand out infinitely lasting tokens. Having an expiry date (even if it is a year) guarantees nobody will be able to abuse your services infinitely.

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

No branches or pull requests

4 participants