1
0
Fork 0
forked from mirror/pixelfed

Updated AuthServiceProvider, added support for configurable OAuth tokens and refresh tokens lifetime

This commit is contained in:
Daniel Supernault 2020-11-21 20:24:36 -07:00
parent 93a76b3c05
commit 7cfae612db
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -28,8 +28,8 @@ class AuthServiceProvider extends ServiceProvider
if(config('pixelfed.oauth_enabled')) { if(config('pixelfed.oauth_enabled')) {
Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]); Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]);
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration'))); Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 15)));
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration'))); Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 30)));
Passport::enableImplicitGrant(); Passport::enableImplicitGrant();
if(config('instance.oauth.pat.enabled')) { if(config('instance.oauth.pat.enabled')) {
Passport::personalAccessClientId(config('instance.oauth.pat.id')); Passport::personalAccessClientId(config('instance.oauth.pat.id'));