planiverse

A minimalist, no-JS front-end for Mastodon.
git clone https://git.stjo.hn/planiverse
Log | Files | Refs | README | LICENSE

commit 9a0fb86099e700629415fc8bdce2d9e098ea3e1e
parent 623a94d4343a8c29a60494a7ebb8ea7e4b38662a
Author: St John Karp <stjohn@fuzzjunket.com>
Date:   Sat, 16 Mar 2019 10:37:53 +0000

Issue 4 - Specify scopes for authorization

We were requesting read, write, and follow for the app, but not
for the user authorization. I've added these scopes to the oauth
redirect when logging in.

Diffstat:
Mapp/Http/Controllers/LoginController.php | 20+++++++++++---------
Mconfig/services.php | 2+-
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/app/Http/Controllers/LoginController.php b/app/Http/Controllers/LoginController.php @@ -12,14 +12,14 @@ use Socialite; */ class LoginController extends Controller { - /** - * Direct the user to the Mastodon OAuth login page. - * - * First check to see if we are registered as an app with the Mastodon API, - * then direct users to the OAuth login. - * - * @return Illuminate\Http\RedirectResponse Redirect to the OAuth login. - */ + /** + * Direct the user to the Mastodon OAuth login page. + * + * First check to see if we are registered as an app with the Mastodon API, + * then direct users to the OAuth login. + * + * @return Illuminate\Http\RedirectResponse Redirect to the OAuth login. + */ public function login() { # Check if this app is already registered. @@ -70,7 +70,9 @@ class LoginController extends Controller session(['client_secret' => $client_secret]); # Redirect the user to their instance to log in. - return Socialite::driver('mastodon')->redirect(); + return Socialite::driver('mastodon') + ->setScopes(config('services.mastodon.scope', config('services.mastodon.scopes'))) + ->redirect(); } /** diff --git a/config/services.php b/config/services.php @@ -41,6 +41,6 @@ return [ 'client_secret' => env('MASTODON_SECRET'), 'redirect' => env('MASTODON_REDIRECT'), //'read', 'write', 'follow' - 'scopes' => ['read', 'write', 'follow'], + 'scopes' => ['read', 'write', 'follow'], ], ];