PHPackages                             jakebooy2/discord-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. jakebooy2/discord-provider

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

jakebooy2/discord-provider
==========================

OAuth2 Provider for Discord

3.4(4y ago)1218PHPPHP ^7.0 || ^8.0

Since Aug 8Pushed 4y agoCompare

[ Source](https://github.com/jakebooy2/discord-provider)[ Packagist](https://packagist.org/packages/jakebooy2/discord-provider)[ RSS](/packages/jakebooy2-discord-provider/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (1)Versions (15)Used By (0)

Jakebooy/DiscordProvider
========================

[](#jakebooydiscordprovider)

1. Installation
---------------

[](#1-installation)

```
composer require jakebooy2/discord-provider

```

2. Service Provider
-------------------

[](#2-service-provider)

Add `\SocialiteProviders\Manager\ServiceProvider::class` to your `providers[]` array in `config\app.php`. For example:

```
'providers' => [
    // a whole bunch of providers
    // remove 'Laravel\Socialite\SocialiteServiceProvider',
    \SocialiteProviders\Manager\ServiceProvider::class, // add
];

```

3. Event Listener
-----------------

[](#3-event-listener)

- Add `SocialiteProviders\Manager\SocialiteWasCalled` event to your `listen[]` array in `app/Providers/EventServiceProvider`.
- Add your listeners (i.e. the ones from the providers) to the `SocialiteProviders\Manager\SocialiteWasCalled[]` that you just created.
- The listener that you add for this provider is `'SocialiteProviders\\Discord\\DiscordExtendSocialite@handle',`.
- Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers. For example:

```
/**
 * The event handler mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // add your listeners (aka providers) here
        'Jakebooy\\DiscordProvider\\DiscordExtendSocialite@handle',
    ],
];

```

You will need to add an entry to the services configuration file so that after config files are cached for usage in production environment (Laravel command `artisan config:cache`) all config is still available.

4. Add to `config/services.php`.
--------------------------------

[](#4-add-to-configservicesphp)

```
'discord' => [
    'client_id' => env('DISCORD_KEY'),
    'client_secret' => env('DISCORD_SECRET'),
    'redirect' => env('DISCORD_REDIRECT_URI'),
    'bot_token' => env('DISCORD_BOT_TOKEN'),
],

```

5. Usage
--------

[](#5-usage)

Using the provider is as simple as just providing the discord driver with Socialite.

#### Retrieving the Access Token Response Body

[](#retrieving-the-access-token-response-body)

Laravel Socialite by default only allows access to the `access_token`. Which can be accessed via the `\Laravel\Socialite\User->token` public property. Sometimes you need access to the whole response body which may contain items such as a `refresh_token`.

You can get the access token response body, after you called the `user()` method in Socialite, by accessing the property `$user->accessTokenResponseBody`;

```
$user = Socialite::driver('discord')->user();
$accessTokenResponseBody = $user->accessTokenResponseBody;

```

#### Logging In

[](#logging-in)

```
use Socialite;

public function login(){
  return Socialite::with('discord')->redirect();
}
public function confirm(){
  $user = Socialite::driver('discord')->user();
  //
}

```

#### Refreshing the Token

[](#refreshing-the-token)

```
use Socialite;

public function refresh($token){
  $response = Socialite::driver('discord')->refreshToken($token);
  // $response->access_token
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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 ~42 days

Recently: every ~19 days

Total

13

Last Release

1597d ago

Major Versions

1.1 → 2.12021-02-21

2.5 → 3.02021-10-11

PHP version history (2 changes)1.0PHP ^5.6 || ^7.0

3.1PHP ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/55241d05d7f9434f49315478e2dc7a3a5c86bb7007a327a839cc2b79c2724129?d=identicon)[jakebooy2](/maintainers/jakebooy2)

---

Top Contributors

[![jakebooy2](https://avatars.githubusercontent.com/u/8533811?v=4)](https://github.com/jakebooy2 "jakebooy2 (22 commits)")

---

Tags

hacktoberfest

### Embed Badge

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

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

###  Alternatives

[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

326.1M13](/packages/socialiteproviders-microsoft)[socialiteproviders/apple

Apple OAuth2 Provider for Laravel Socialite

618.4M8](/packages/socialiteproviders-apple)[socialiteproviders/instagram

Instagram OAuth2 Provider for Laravel Socialite

421.9M5](/packages/socialiteproviders-instagram)[socialiteproviders/microsoft-azure

Microsoft Azure OAuth2 Provider for Laravel Socialite

556.0M19](/packages/socialiteproviders-microsoft-azure)[socialiteproviders/laravelpassport

LaravelPassport OAuth2 Provider for Laravel Socialite

621.3M7](/packages/socialiteproviders-laravelpassport)[socialiteproviders/discord

Discord OAuth2 Provider for Laravel Socialite

422.0M17](/packages/socialiteproviders-discord)

PHPackages © 2026

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