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.8.0(2mo ago)24133.8k—0.9%13[2 issues](https://github.com/Kovah/laravel-socialite-oidc/issues)MITPHPPHP ^8.1

Since Sep 17Pushed 2mo 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 today

READMEChangelog (8)Dependencies (12)Versions (11)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' => explode(' ', env('OIDC_SCOPES')),
],
```

---

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

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.5% 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 ~84 days

Recently: every ~106 days

Total

8

Last Release

65d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1816101?v=4)[Kevin Woblick](/maintainers/Kovah)[@Kovah](https://github.com/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 (17 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (6 commits)")[![Kravets1996](https://avatars.githubusercontent.com/u/40546480?v=4)](https://github.com/Kravets1996 "Kravets1996 (1 commits)")[![axlon](https://avatars.githubusercontent.com/u/3661474?v=4)](https://github.com/axlon "axlon (1 commits)")[![overworks](https://avatars.githubusercontent.com/u/2780002?v=4)](https://github.com/overworks "overworks (1 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)")

---

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

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M886](/packages/laravel-socialite)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[socialiteproviders/apple

Apple OAuth2 Provider for Laravel Socialite

629.5M15](/packages/socialiteproviders-apple)[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

347.3M25](/packages/socialiteproviders-microsoft)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6804.7k6](/packages/hasinhayder-tyro)

PHPackages © 2026

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