Open ahmedguesmi opened 5 years ago
@tymondesigns
What you're describing is implementing the access/refresh token pair from OAuth2. Here is the difference between an access token and refresh token from stackoverflow:
The idea of refresh tokens is that if an access token is compromised, because it is short-lived, the attacker has a limited window in which to abuse it.
Refresh tokens, if compromised, are useless because the attacker requires the client id and secret in addition to the refresh token in order to gain an access token.
However, JavaScript and mobile applications live in userland and, therefore, are public clients. Public clients are clients that cannot safely store a client_secret
to ensure their identity.
As a result, public clients cannot leverage the extra security of having refresh tokens. Refresh tokens that do not need client identification to generate new access tokens are as powerful as access tokens.
Therefore your suggestion is equivalent to extending the time window of access tokens.
Btw, lots of applications do that. E.g. Koel from Phanan.
@lorisleiva that made some sense to me thanks. So this basically means the JWT_REFRESH_TTL
in config/jwt.php
is of no use in these situations? I dont see how this variable is of any use when refresh_token
s are not in use.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Your environment
I am in the course of developing an API, I have a refreshing token problem, at this moment I do a controller that receives the refreshing request with the valid token and the controller will create a new token and puts the last one to the blacklist, the Problem here is the mobile developer how will know the expiration time of the token I see that it is not practical to send at any time to test the validity of the token because the controller I use it can not refreshire an expired token for example: the validity of my token 60 min if the mobile developer does not make a request before this 60 min it will disconnect from the application because the token will expire and it cannot refresh, but if he sends a requests to refresh token before this 60 min everything will go well. my question is can I generate two tokens the first normal token and the second when the developer sends a requette and he receives a 401 request he uses the refresh token to generate another two tokens and so he stays connected until he makes a manual disconnection
my controller AUthcontroller :