Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Socialite Discord

Socialite Discord Laravel Package

revolution/socialite-discord

Discord OAuth2 provider for Laravel Socialite. Adds Discord login to your Laravel app with a simple driver: install the package, add your Discord client ID and secret, then use Socialite::driver('discord') to authenticate users and retrieve their Discord profile.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Socialite Discord
How do I install and configure revolution/socialite-discord in a Laravel app?
Install it with Composer using composer require revolution/socialite-discord, then add your Discord client ID, client secret and redirect URL to the discord entry in config/services.php. Register the driver in a service provider, add a redirect route and a callback route in routes/web.php, and call Socialite::driver('discord')->redirect() to start the flow. On the callback, Socialite::driver('discord')->user() returns the authenticated Discord profile. You also need to register the exact callback URL in the Discord developer portal or Discord will reject the exchange.
How do I register the Discord driver with Laravel Socialite?
This package is a thin adapter that implements Socialite's AbstractProvider contract, so it exposes Discord as a standard driver rather than shipping its own manager. You register it in a service provider, typically with Socialite::extend('discord', ...), or through the SocialiteProviders listener pattern if the package documents that route. Once registered, the normal Socialite calls to redirect() and user() work unchanged. There are no service container bindings, middleware or migrations to wire up.
Which Laravel and Socialite versions does this Discord provider support?
Check the illuminate/socialite constraint in the package's composer.json before adopting it, because Socialite's provider contract has shifted across Laravel 9, 10, 11 and 12. A low-traffic package may lag behind those changes, and a narrow constraint can block your Laravel upgrade path. The safest move is to run composer why-not or a scratch install against your target framework version and confirm the round-trip works. Treat version compatibility as a gate in your evaluation rather than an afterthought.
How do I handle Discord accounts that return a null email address?
Discord only returns an email when the email scope is granted and the account's email is verified, so unverified accounts come back with a null email. Because this package simply maps the user payload, the decision is yours: fail closed and reject the login, or create the user with a null email and prompt for one later. Silently creating an account keyed on a null email is the failure mode you want to avoid. Test this case explicitly in staging before shipping.
What user fields does the Discord driver return, including avatar and global_name?
The driver calls Discord's /users/@me endpoint and maps the payload onto a Socialite User object with id, nickname, name, email and avatar. Discord returns the avatar as a hash rather than a full URL, so you build the CDN path yourself as https://cdn.discordapp.com/avatars/{id}/{hash}.png. Discord's v10 API also exposes global_name, and whether that field is surfaced depends on how current the package's mapping is, so verify it during a short spike rather than assuming.
Is revolution/socialite-discord safe to use in production?
The package has minimal adoption signal, roughly 8 stars and no dependents, and appears to be a single-maintainer project with no evidence of a CI or test suite. Because it sits directly in the authentication path, that becomes a supply-chain consideration even though it is MIT licensed. For many teams the better answer is to depend on it only after a spike, or to vendor a small in-house provider you control. Whichever you choose, review the source since it is small enough to read in one sitting.
How does this compare to socialiteproviders/discord?
socialiteproviders/discord is the established option inside the SocialiteProviders ecosystem, with a shared manager, listener-based registration and thousands of installs. That ecosystem backing brings implicit regression testing and faster response to Discord API changes. revolution/socialite-discord delivers the same basic OAuth2 round-trip with none of that adoption or maintenance track record. If socialiteproviders/discord clears your version-constraint check, it usually wins on ecosystem and maintenance grounds.
Should I write my own Discord Socialite provider instead of using this package?
The contract this package implements is small, effectively getAuthUrl, getTokenUrl, getUserByToken and mapUserToObject, and it can be reproduced in roughly 50 to 80 lines of in-house code. Writing your own gives you explicit control over scope negotiation, null email handling and which Discord fields you map, with no third-party dependency in your auth path. The tradeoff is that you own the upkeep when Discord changes its endpoints or payloads. For a secondary login option alongside Google or GitHub, either route is defensible; for a primary one, ownership often wins.
Do I need database migrations or extra packages to store Discord users?
No, the package has no persistence layer, no migrations and no service container bindings. You are responsible for adding provider and provider_id columns to your users table, or a separate social accounts table, and for saving the profile fields you care about in the callback. That keeps the dependency isolated to the auth boundary but means account linking and duplicate-email logic are entirely your code. Standard Socialite practice applies here.
Can I use this package for Discord bot permissions, guild roles or SSO?
No, this is user OAuth only, aimed at sign-in flows with scopes like identify, email and guilds. It does not give you bot tokens, guild moderation permissions or role-based access control, and it is not an enterprise SSO or OIDC solution. If you need to act inside a guild or read member data beyond the authorizing user, you need a Discord bot integration instead. Use this driver when Discord is a consumer login option alongside providers like Google or GitHub.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console