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
Personal Access Token expiration can't be set and it fails to check the Y2K38 bug. #162
Comments
Yeah I always get negative value of expires_in ( -1477799197 ) and the only way to fix it is to modify the vendor files. |
Yes, I just wasted one day to find this problem, It happend only happend on 32bit php. For now, maybe we need modify passport/src/Passport.php @ 190 line, 100 Years is really too long :-D |
@nugrahawahyu you can simply change the token-lifetime - it solved my problems /**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Passport::routes();
Passport::tokensExpireIn(Carbon::now()->addDays(30));
} |
TokensExpireIn 'only' works for Authorization Code and Password Grant tokens, not for personal access tokens. |
a PR was submitted to solve the issue: #185 |
To change the expiration date of a PersonalAccessToken could create a ServiceProvider that extends from the Passport Service Provider. for example: To add 1 hour edit method registerAuthorizationServer() and change this
for this
|
Hi guys, I've set the |
@diazemiliano in my case it doesn't validated at all, no matter which type of client I'm used. |
My password granted tokens seem to be expiring much more quickly than Carbon::now()->addDays(1)... they seem to last about 2 hours max |
$authorizarionServer = app()->make(\League\OAuth2\Server\AuthorizationServer::class);
|
十分感谢 @DiegoGutman 的方案完美解决了我的问题 ,向你致敬 |
Thanks @dgutman10 ! |
One can simply update the expiry time for Personal token using personalAccessTokensExpireIn method in AuthServiceProvider's boot method. |
You are trying to create Personal Access Token. // Passport::tokensExpireIn(now()->addDays(15)); Get or set when personal access tokens expire.
|
This will work 💯% Passport::personalAccessTokensExpireIn(now()->addMinutes(10)); |
Yes, it works, but how do I make it so that it is not issued globally? For example, in |
Using the Passport facade to set the Expiration time for Authorization Code and Password Grant you can avoid the dreaded Y2K38 bug but Personal Access Tokens are hardcoded to last another hundred years from now, which puts it well beyond 2038.
This is a problem because on most Windows environments the tokens will never match and never authenticate the user.
The only way to bypass this is to modify the vendor files and do it every time Passport is upgraded.
The text was updated successfully, but these errors were encountered: