Update config, make oauth opt-in

This commit is contained in:
Daniel Supernault 2019-04-17 19:45:23 -06:00
parent a665b90b60
commit bedb42baca
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 17 additions and 13 deletions

View file

@ -25,19 +25,21 @@ class AuthServiceProvider extends ServiceProvider
{ {
$this->registerPolicies(); $this->registerPolicies();
Passport::routes(); if(config('pixelfed.oauth_enabled')) {
Passport::tokensExpireIn(now()->addDays(15)); Passport::routes();
Passport::refreshTokensExpireIn(now()->addDays(30)); Passport::tokensExpireIn(now()->addDays(15));
Passport::enableImplicitGrant(); Passport::refreshTokensExpireIn(now()->addDays(30));
Passport::enableImplicitGrant();
Passport::setDefaultScope([
'user:read', Passport::setDefaultScope([
'user:write' 'user:read',
]); 'user:write'
]);
Passport::tokensCan([ Passport::tokensCan([
'user:read' => 'Read a users profile info and media', 'user:read' => 'Read a users profile info and media',
'user:write' => 'This scope lets an app "Change your profile information"', 'user:write' => 'This scope lets an app "Change your profile information"',
]); ]);
}
} }
} }

View file

@ -276,4 +276,6 @@ return [
] ]
] ]
], ],
'oauth_enabled' => env('OAUTH_ENABLED', false),
]; ];