From 6d6f517db0cdddf472c6fff0d81f5fbc32cd0141 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 30 Sep 2019 22:59:16 -0600 Subject: [PATCH 1/3] Update AuthServiceProvider --- app/Providers/AuthServiceProvider.php | 4 +++- composer.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 6f077f832..2df9dafd6 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -27,7 +27,9 @@ class AuthServiceProvider extends ServiceProvider $this->registerPolicies(); if(config('pixelfed.oauth_enabled')) { - Passport::routes(); + Route::group(['middleware' => 'cors'], function() { + Passport::routes(); + }); Passport::tokensExpireIn(now()->addDays(15)); Passport::refreshTokensExpireIn(now()->addDays(30)); Passport::enableImplicitGrant(); diff --git a/composer.json b/composer.json index 93aad5904..81f06ddd7 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", + "barryvdh/laravel-cors": "0.11.4", "beyondcode/laravel-self-diagnosis": "^1.0.2", "doctrine/dbal": "^2.7", "fideloper/proxy": "^4.0", From e10b2b93a43f9287d988209817f9fefae0575beb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 30 Sep 2019 23:03:35 -0600 Subject: [PATCH 2/3] Update AuthServiceProvider --- app/Providers/AuthServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 2df9dafd6..585d13f14 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -4,7 +4,7 @@ namespace App\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Laravel\Passport\Passport; -use Gate; +use Gate, Route; class AuthServiceProvider extends ServiceProvider { From dbcd5ff2e4249d03c775241aa10eec26e0fdeef6 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 30 Sep 2019 23:36:37 -0600 Subject: [PATCH 3/3] Update AuthServiceProvider --- app/Providers/AuthServiceProvider.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 585d13f14..6f077f832 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -4,7 +4,7 @@ namespace App\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Laravel\Passport\Passport; -use Gate, Route; +use Gate; class AuthServiceProvider extends ServiceProvider { @@ -27,9 +27,7 @@ class AuthServiceProvider extends ServiceProvider $this->registerPolicies(); if(config('pixelfed.oauth_enabled')) { - Route::group(['middleware' => 'cors'], function() { - Passport::routes(); - }); + Passport::routes(); Passport::tokensExpireIn(now()->addDays(15)); Passport::refreshTokensExpireIn(now()->addDays(30)); Passport::enableImplicitGrant();