Socialite Redirect

Socialstream generates the OAuth redirect for a provider using the following logic:


You may find you want to alter this logic; for example, you may wish to alter the scopes requested from the provider at runtime. To do so, simply update the generate method of your applications app/Actions/Socialstream/GenerateRedirectForProvider.php action file:

public function generate(string $provider): RedirectResponse
    $scopes = ['*'];

    if ($provider = 'github' && config('services.github.manage_repos') {
        $scopes = array_merge($scopes, [
    return Socialite::driver($provider)
        ->with(['response_type' => 'token'])

Last updated