jakyeru/larascord
Larascord is a Laravel package for Discord OAuth2 authentication. It adds a simple Discord login flow, integrates with Laravel Socialite and your user model, and provides configurable routes, scopes, and callbacks for quick setup.
Larascord adds "Login with Discord" and Discord guild/role awareness to a Laravel app. The v8.0.0 release adds Laravel 13 support and reworks the internals so the package can be dropped into an existing project (its own User model, its own users table) rather than requiring a fresh install — which is the single most important thing to verify before you follow older tutorials or the v7 docs.
composer require valentinneaga/larascord:^8.0 (confirm the exact vendor string on Packagist; v8 is the first release advertising Laravel 13, so check the illuminate/* constraint against your app version before upgrading).php artisan vendor:publish --tag=larascord-config
php artisan vendor:publish --tag=larascord-migrations
Read the migration before running it. Because v8 targets existing projects, the schema changes should be additive (Discord columns / a linked-accounts table) — if you see it creating a users table or altering columns you already own, stop and reconcile.discord.com/developers/applications: copy the Client ID/Secret, and add the redirect URI exactly as it appears in php artisan route:list | grep -i discord.DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET, DISCORD_REDIRECT_URI, plus a guild ID and bot token if you plan to gate on membership/roles. Map these to whatever keys the published config actually reads.App\Models\User and confirm the column/attribute names match the migration.php artisan migrate && php artisan config:cache.First use case: gated community access — "sign in with Discord, and only members of your server with the Member role get in." That exercises the whole surface (OAuth callback, token storage, guild/role lookup) in one flow, and is the fastest way to validate the v8 install.
Gate::define('access-premium', fn (User $u) => Larascord::userHasRole($u, 'Premium'));
Keep the role names in config, not literals, so staging and prod servers can differ.discord_roles table) at login and refresh on a schedule or on-demand. Per-request Discord API calls will hit rate limits the moment you have real traffic.guilds.join (auto-add users to the server on signup), that requires a bot token, the guilds.join scope, and the bot already present in the guild — plan the Discord-side setup as part of the feature, not an afterthought.Http::fake() around the token exchange and /users/@me, then assert against the callback route. Seed the user's cached roles directly so authorization tests never touch the network.diff against your published copies rather than overwriting; grep your codebase for the facade, trait, directive, and event class names. Test the upgrade on a copy of the real app first.www all matter, and dev/staging/prod each need their own entry. invalid_client and invalid_grant errors usually trace back to this or a stale secret.encrypted, store the expiry, and refresh before use — a long-lived "remember me" session will otherwise break silently.guilds scope returns partial data. Role checks need the bot token plus the guild members intent; without it, membership/role helpers can return empty results that look like "user has no roles" rather than an error. Log the raw response once during setup so you know which case you're in.429 with a retry_after body; respect it and back off, and never call the API inside a Blade view or an accessor.config:cache; queued listeners and scheduled refreshes can see null credentials if you read env() outside the config file. Always go through config('larascord.*').APP_URL are consistent, or the OAuth state check fails intermittently in production only.state. Confirm the package validates the OAuth state parameter; if the redesign touched the callback controller, re-check CSRF/state handling before shipping.How can I help you explore Laravel packages today?