๐Ÿ‘จโ€๐Ÿ’ป
Socialstream
  • Introduction
  • โฎ๏ธPrologue
    • Release Notes
    • Upgrade Guide
      • Upgrading to v6 from 5.x
      • Upgrading to v5 from 4.x
      • Upgrading to v4 from 3.x
      • Upgrading to v3 from 2.x
      • Upgrading to v2 from 1.x
    • Contribution Guide
  • ๐Ÿ”‘Getting Started
    • Installation
    • Configuration
    • Customization
      • Socialite Redirect
      • Resolving Users
      • Handling Invalid State
      • Handling OAuth Errors
      • Authenticating Users
  • ๐Ÿš€Features
    • Remember Session
    • Refresh Expired Tokens
    • Provider Avatars
    • Global Login
    • Register from Login
    • Missing Emails
    • Auth Existing Unlinked Users
    • Login on Registration (deprecated)
  • ๐Ÿงพguides
    • Standalone Installation
    • Filament with Jetstream
    • Filament with Breeze
    • Laravel Passport
    • Socialite Providers
    • Overriding Fortify's Authentication
  • ๐Ÿ”—Links
    • View Code On GitHub
    • About Me
    • Contribute
    • Donate
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started
  2. Customization

Socialite Redirect

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

Socialite::driver($provider)->redirect()

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, [
            'repos.manage',
        ]);
    }
    
    return Socialite::driver($provider)
        ->scopes($scopes)
        ->with(['response_type' => 'token'])
        ->redirect();
}
PreviousCustomizationNextResolving Users

Last updated 1 year ago

Was this helpful?

๐Ÿ”‘