planiverse

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

commit d45fc6a697164b588b4def32648ca16357fb6926
parent 7ff9a5ceda9711a102c22c6c74d87b4dcc023316
Author: St John Karp <contact@stjo.hn>
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'], ], ];