๐Ÿ‘จโ€๐Ÿ’ป
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

Handling OAuth Errors

PreviousHandling Invalid StateNextAuthenticating Users

Last updated 1 year ago

Was this helpful?

When a user encounters an error returning from an OAuth flow, it will automatically detect the error and display this to the user:

This is done by grabbing the error_description from the request object and passing that value to a socialstream message bag. This can be accessed from your application:

@error('socialstream')

$errors->get('socialstream');

session('errors')?->get('socialstream');

If you wish to customize how Socialstream handles callback errors, you may do so by creating an "action" that implements the HandlesOauthCallbackErrors contract and registering it with Socialstream in the boot method of a service provider:

public function boot(): void
{
    Socialstream::handlesOAuthCallbackErrorsUsing(CustomOauthCallbackHandler::class);
}

๐Ÿ”‘