PHPackages                             kovah/laravel-socialite-oidc - 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. kovah/laravel-socialite-oidc

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

kovah/laravel-socialite-oidc
============================

OpenID Connect OAuth2 Provider for Laravel Socialite

v0.7.0(2mo ago)2073.7k—1.2%10[3 issues](https://github.com/Kovah/laravel-socialite-oidc/issues)MITPHPPHP ^8.1

Since Sep 17Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/Kovah/laravel-socialite-oidc)[ Packagist](https://packagist.org/packages/kovah/laravel-socialite-oidc)[ Docs](https://github.com/kovah/laravel-socialite-oidc)[ GitHub Sponsors](https://github.com/sponsors/kovah)[ RSS](/packages/kovah-laravel-socialite-oidc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (8)Versions (10)Used By (0)

OpenID Connect (OIDC) Provider for Laravel Socialite
====================================================

[](#openid-connect-oidc-provider-for-laravel-socialite)

[![Laravel Support: v9, v10, v11](https://camo.githubusercontent.com/59bc22f04872e73d2db2690bda243763a425a1c2d8a7c4afdbd2f808dd5a57ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c253230537570706f72742d76392532432532307631302532432532307631312d626c7565)](https://camo.githubusercontent.com/59bc22f04872e73d2db2690bda243763a425a1c2d8a7c4afdbd2f808dd5a57ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c253230537570706f72742d76392532432532307631302532432532307631312d626c7565) [![PHP Support: 8.1, 8.2, 8.3](https://camo.githubusercontent.com/7446a90723f3f06194bc686845a81275f2a55230681af9c10579574b5aed418c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850253230537570706f72742d382e31253243253230382e32253243253230382e332d626c7565)](https://camo.githubusercontent.com/7446a90723f3f06194bc686845a81275f2a55230681af9c10579574b5aed418c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850253230537570706f72742d382e31253243253230382e32253243253230382e332d626c7565)

Installation &amp; Basic Usage
------------------------------

[](#installation--basic-usage)

```
composer require kovah/laravel-socialite-oidc
```

Please see the [Base Installation Guide](https://socialiteproviders.com/usage/), then follow the provider specific instructions below.

### Add configuration to `config/services.php`

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

```
'oidc' => [
    'base_url' => env('OIDC_BASE_URL'),
    'client_id' => env('OIDC_CLIENT_ID'),
    'client_secret' => env('OIDC_CLIENT_SECRET'),
    'redirect' => env('OIDC_REDIRECT_URI'),

    // Optional: Enable JWT signature verification (default: false)
    'verify_jwt' => env('OIDC_VERIFY_JWT', false),

    // Optional: Provide a specific public key for JWT verification
    // If not provided, the key will be fetched from the OIDC provider's JWKS endpoint
    'jwt_public_key' => env('OIDC_JWT_PUBLIC_KEY'),
],
```

The base URL must be set to the URL of your OIDC endpoint excluding the `.well-known/openid-configuration` part. For example: If `https://auth.company.com/application/linkace/.well-known/openid-configuration` is your OIDC configuration URL, then `https://auth.company.com/application/linkace` must be your base URL.

### JWT Signature Verification

[](#jwt-signature-verification)

By default, this package does not verify the JWT signature of the `id_token`. According to the OpenID Connect specification, signature verification is not required when TLS is used and the token is transmitted directly from the authorization server to the client.

However, for enhanced security, you can enable JWT signature verification by setting `verify_jwt` to `true` in your configuration:

```
'oidc' => [
    // ... other configuration
    'verify_jwt' => true,
],
```

When JWT verification is enabled:

1. **Automatic JWKS fetching**: The provider will automatically fetch the JSON Web Key Set (JWKS) from your OIDC provider's `.well-known/openid-configuration` endpoint
2. **Caching**: JWKS data is cached for 1 hour to improve performance
3. **Custom public key**: Alternatively, you can provide a specific public key using the `jwt_public_key` option

**Example with custom public key:**

```
'oidc' => [
    // ... other configuration
    'verify_jwt' => true,
    'jwt_public_key' => '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
-----END PUBLIC KEY-----',
],
```

### Add provider event listener

[](#add-provider-event-listener)

Configure the package's listener to listen for `SocialiteWasCalled` events.

#### Laravel 11+

[](#laravel-11)

In Laravel 11, the default `EventServiceProvider` provider was removed. Instead, add the listener using the `listen` method on the `Event` facade, in your `AppServiceProvider` `boot` method.

```
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    $event->extendSocialite('oidc', \SocialiteProviders\OIDC\Provider::class);
});
```

#### Laravel 10 or below

[](#laravel-10-or-below)

Add the event to your listen\[\] array in `app/Providers/EventServiceProvider`. See the [Base Installation Guide](https://socialiteproviders.com/usage/) for detailed instructions.

```
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        \SocialiteProviders\OIDC\OIDCExtendSocialite::class.'@handle',
    ],
];
```

### Usage

[](#usage)

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):

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

### Returned User fields

[](#returned-user-fields)

- `id`
- `name`
- `email`

More fields are available under the `user` subkey:

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

$locale = $user->user['locale'];
$email_verified = $user->user['email_verified'];
```

### Customizing the scopes

[](#customizing-the-scopes)

You may extend the default scopes (`openid email profile`) by adding a `scopes` option to your OIDC service configuration and separate multiple scopes with a space:

```
'oidc' => [
    'base_url' => env('OIDC_BASE_URL'),
    'client_id' => env('OIDC_CLIENT_ID'),
    'client_secret' => env('OIDC_CLIENT_SECRET'),
    'redirect' => env('OIDC_REDIRECT_URI'),

    'scopes' => 'groups roles',
    // or
    'scopes' => env('OIDC_SCOPES'),
],
```

---

Based on the work of [jp-gauthier](https://github.com/jp-gauthier)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance80

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.4% 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 ~91 days

Recently: every ~121 days

Total

7

Last Release

61d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97cc4ec017b84d17afbc2fd36d1c7697dc046f37d490a10bde330a1f167b816a?d=identicon)[Kovah](/maintainers/Kovah)

---

Top Contributors

[![jp-gauthier](https://avatars.githubusercontent.com/u/2091491?v=4)](https://github.com/jp-gauthier "jp-gauthier (31 commits)")[![Kovah](https://avatars.githubusercontent.com/u/1816101?v=4)](https://github.com/Kovah "Kovah (15 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (6 commits)")[![Boy132](https://avatars.githubusercontent.com/u/8203120?v=4)](https://github.com/Boy132 "Boy132 (1 commits)")[![Jubeki](https://avatars.githubusercontent.com/u/15707543?v=4)](https://github.com/Jubeki "Jubeki (1 commits)")[![overworks](https://avatars.githubusercontent.com/u/2780002?v=4)](https://github.com/overworks "overworks (1 commits)")

---

Tags

oidcsocialitesocialite-providersssolaravelprovideroauthsocialiteoidc

### Embed Badge

![Health badge](/badges/kovah-laravel-socialite-oidc/health.svg)

```
[![Health](https://phpackages.com/badges/kovah-laravel-socialite-oidc/health.svg)](https://phpackages.com/packages/kovah-laravel-socialite-oidc)
```

###  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/kakao

Kakao OAuth2 Provider for Laravel Socialite

10484.7k4](/packages/socialiteproviders-kakao)

PHPackages © 2026

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