Skip to main content

Overview

revolution/socialite-discord is a driver package that adds Discord OAuth2 support to Laravel Socialite. Discord is not included among Socialite’s built-in providers. Install this package and you can immediately use Socialite::driver('discord') to add Discord login to your application.
For a general guide on Laravel Socialite, see the Socialite guide.

Installation

Configuration

Register your app in the Discord Developer Portal

Create an application in the Discord Developer Portal and retrieve the Client ID and Client Secret from the OAuth2 section. Add your callback URL (e.g. https://example.com/auth/discord/callback) to the Redirects list.

config/services.php

.env

Basic usage

1

Define routes

Add a redirect route and a callback route to routes/web.php.
2

Create the controller

Scopes

Discord OAuth2 uses scopes to control which data your application can access. The default scope is identify only.
Common scopes:
For a full list of scopes, see the Discord OAuth2 documentation.

Saving the user and logging in

A typical callback implementation that persists the user to the database and logs them in:
The email scope is required to retrieve an email address. Without it, getEmail() may return null.

Comparison with other Socialite drivers

This package is implemented using Socialite::extend(), the official method for adding custom drivers. It exposes the same API as any built-in provider. For details on how custom providers work and how Socialite::extend() is used, see the Socialite guide.
For the latest information, refer to the GitHub repository.
Last modified on April 30, 2026