diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 4a647cbd7..968c4cfa6 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -25,19 +25,21 @@ class AuthServiceProvider extends ServiceProvider { $this->registerPolicies(); - Passport::routes(); - Passport::tokensExpireIn(now()->addDays(15)); - Passport::refreshTokensExpireIn(now()->addDays(30)); - Passport::enableImplicitGrant(); - - Passport::setDefaultScope([ - 'user:read', - 'user:write' - ]); + if(config('pixelfed.oauth_enabled')) { + Passport::routes(); + Passport::tokensExpireIn(now()->addDays(15)); + Passport::refreshTokensExpireIn(now()->addDays(30)); + Passport::enableImplicitGrant(); + + Passport::setDefaultScope([ + 'user:read', + 'user:write' + ]); - Passport::tokensCan([ - 'user:read' => 'Read a user’s profile info and media', - 'user:write' => 'This scope lets an app "Change your profile information"', - ]); + Passport::tokensCan([ + 'user:read' => 'Read a user’s profile info and media', + 'user:write' => 'This scope lets an app "Change your profile information"', + ]); + } } } diff --git a/config/pixelfed.php b/config/pixelfed.php index b45770827..a43be8b4d 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -276,4 +276,6 @@ return [ ] ] ], + + 'oauth_enabled' => env('OAUTH_ENABLED', false), ];