PHPackages                             kayckmatias/discord-socialite-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. kayckmatias/discord-socialite-provider

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

kayckmatias/discord-socialite-provider
======================================

A Complete Discord Provider for Laravel Socialite Package

1.0.1(1y ago)314MITPHP

Since Oct 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/KayckMatias/discord-socialite-provider)[ Packagist](https://packagist.org/packages/kayckmatias/discord-socialite-provider)[ RSS](/packages/kayckmatias-discord-socialite-provider/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Discord Socialite Provider for Laravel
======================================

[](#discord-socialite-provider-for-laravel)

[![Packagist](https://camo.githubusercontent.com/d7fd8ef28784cf0956f61bba777279727d7a475eeb5f8b0ca9eb7a4e37e40a94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6179636b6d61746961732f646973636f72642d736f6369616c6974652d70726f7669646572)](https://camo.githubusercontent.com/d7fd8ef28784cf0956f61bba777279727d7a475eeb5f8b0ca9eb7a4e37e40a94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6179636b6d61746961732f646973636f72642d736f6369616c6974652d70726f7669646572)[![License](https://camo.githubusercontent.com/d0b019b579197a0a558f3401f14988b7d74476ef8322ea13240d152819c4748d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b6179636b6d61746961732f646973636f72642d736f6369616c6974652d70726f7669646572)](https://camo.githubusercontent.com/d0b019b579197a0a558f3401f14988b7d74476ef8322ea13240d152819c4748d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b6179636b6d61746961732f646973636f72642d736f6369616c6974652d70726f7669646572)

A Discord OAuth2 provider for the Laravel Socialite package. This package allows you to easily integrate Discord login with Laravel applications using Socialite with extra features for Discord OAuth2.

Installation
------------

[](#installation)

1. Install the package via Composer:

    ```
    composer require kayckmatias/discord-socialite-provider
    ```
2. Add the service provider to the config/app.php **(only if you're using Laravel version &lt;5.5 or not using package auto-discovery):**

    ```
    'providers' => [
         KayckMatias\Laravel\Socialite\DiscordServiceProvider::class,
     ],
    ```
3. Add your Discord credentials to the config/services.php file:

    ```
    'discord' => [
        'client_id' => env('DISCORD_CLIENT_ID'),
        'client_secret' => env('DISCORD_CLIENT_SECRET'),
        'redirect' => '/auth/discord/callback',
    ]
    ```

Configuration
-------------

[](#configuration)

You need to register your application with Discord to obtain the credentials required for OAuth2. You can register a new application at the [Discord Developer Portal](https://discord.com/developers/applications).

Once you have your credentials, add the following environment variables to your `.env` file:

```
DISCORD_CLIENT_ID=your-client-id
DISCORD_CLIENT_SECRET=your-client-secret
```

Usage
-----

[](#usage)

Once the package is installed and configured, you can use Discord as a provider with Laravel Socialite.

### Example Redirecting to Discord

[](#example-redirecting-to-discord)

In your controller, use the Socialite facade to redirect the user to the Discord authentication page:

```
use Laravel\Socialite\Facades\Socialite;

public function redirectToDiscord()
{
    return Socialite::driver('discord')->redirect();
}
```

### Handling the Callback

[](#handling-the-callback)

Once the user authorizes the app, Discord will redirect the user back to your application's callback URL. You can handle the callback and retrieve user information as follows:

```
use Laravel\Socialite\Facades\Socialite;

public function handleDiscordCallback()
{
    $user = Socialite::driver('discord')->user();

    // Access user details
    $id = $user->getId();
    $name = $user->getName();
    $nickname = $user->getNickname();
    $email = $user->getEmail();
    $avatar = $user->getAvatar();

    // Handle the user data
}
```

Advanced Features
-----------------

[](#advanced-features)

### Custom Scopes

[](#custom-scopes)

To request with custom scopes, you can use the `setScopes` method:

```
return Socialite::driver('discord')
    ->setScopes(['identify', 'email', 'bot'])
    ->redirect();
```

### Adding Permissions

[](#adding-permissions)

To request additional permissions, you can use the `withPermissions` method:

```
return Socialite::driver('discord')
    ->withPermissions('1689934340028480')
    ->redirect();
```

### Bot Scopes

[](#bot-scopes)

If you're working with a bot, you can use `asBot` to bot scope instead default `identify` scope:

```
return Socialite::driver('discord')
    ->asBot()
    ->redirect();
```

### Specify Guild

[](#specify-guild)

To add the `guild_id=` parameter to the Discord authorization URL, use the `withGuildId` method:

```
return Socialite::driver('discord')
    ->withGuildId('0000000000000000000')
    ->redirect();
```

### Consent Prompt

[](#consent-prompt)

To add the `prompt=none` parameter to the Discord authorization URL, use the `withConsent` method:

```
return Socialite::driver('discord')
    ->withConsent()
    ->redirect();
```

License
-------

[](#license)

This package is open-source and licensed under the MIT license.

More Information
----------------

[](#more-information)

For more information about Discord OAuth, please visit the [Discord OAuth2 Documentation](https://discord.com/developers/docs/topics/oauth2). For more information about Socialite, please visit the [Socialite Documentation](https://laravel.com/docs/socialite).

Issues
------

[](#issues)

For any issues, feel free to open a ticket on the [GitHub repository](https://github.com/KayckMatias/discord-socialite-provider/issues).

Made with love, I hope it helps someone :)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

572d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c208ca332908e1c58347b7c3fbe455a63015b5826f1fcfd6c95e3c090ada1a2?d=identicon)[kayckmatias](/maintainers/kayckmatias)

---

Top Contributors

[![KayckMatias](https://avatars.githubusercontent.com/u/48569093?v=4)](https://github.com/KayckMatias "KayckMatias (5 commits)")

---

Tags

laravelprovideroauthsocialitediscord

### Embed Badge

![Health badge](/badges/kayckmatias-discord-socialite-provider/health.svg)

```
[![Health](https://phpackages.com/badges/kayckmatias-discord-socialite-provider/health.svg)](https://phpackages.com/packages/kayckmatias-discord-socialite-provider)
```

###  Alternatives

[socialiteproviders/discord

Discord OAuth2 Provider for Laravel Socialite

422.0M17](/packages/socialiteproviders-discord)[martinbean/socialite-discord-provider

A Discord provider for Laravel Socialite.

2839.2k](/packages/martinbean-socialite-discord-provider)[socialiteproviders/kakao

Kakao OAuth2 Provider for Laravel Socialite

10484.7k4](/packages/socialiteproviders-kakao)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
