Discord
Discord stats
- Downloads
- 600.3K
- Stars
- 33
- Open Issues
- 0
- Forks
- 14
Discord OAuth2 Provider for Laravel Socialite
Laravel Discord Package Summary
The socialiteproviders/discord package integrates Discord authentication into Laravel applications using the Socialite package. This allows developers to easily implement user authentication through Discord with minimal configuration.
Key Features:
- Seamless Integration: Works with Laravel's existing Socialite package to handle OAuth flows.
- Customizable: Offers options to specify GIF avatars and default avatar extension (jpg, png, webp).
- User Data Access: Provides access to Discord user fields such as id, nickname, name, email, and avatar.
Installation and Configuration:
-
Install the package using Composer:
composer require socialiteproviders/discord -
Configure services by adding Discord credentials in
config/services.php:'discord' => ['client_id' => env('DISCORD_CLIENT_ID'),'client_secret' => env('DISCORD_CLIENT_SECRET'),'redirect' => env('DISCORD_REDIRECT_URI'),'allow_gif_avatars' => (bool)env('DISCORD_AVATAR_GIF', true),'avatar_default_extension' => env('DISCORD_EXTENSION_DEFAULT', 'jpg'),], -
Set up the event listener in
app/Providers/EventServiceProviderto handleSocialiteWasCalledevents:protected $listen = [\SocialiteProviders\Manager\SocialiteWasCalled::class => [\SocialiteProviders\Discord\DiscordExtendSocialite::class.'@handle',],];
Usage:
After configuration, you can initiate authentication with:
return Socialite::driver('discord')->redirect();
This package provides a straightforward way to authenticate users with Discord in a Laravel application, leveraging the power of Socialite for a smooth integration.