PHPackages                             socialiteproviders/duo - 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. socialiteproviders/duo

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

socialiteproviders/duo
======================

Duo SSO OAuth2 Provider for Laravel Socialite

1.0.0(3mo ago)07MITPHPPHP ^8.2

Since Mar 23Pushed 3mo agoCompare

[ Source](https://github.com/SocialiteProviders/Duo)[ Packagist](https://packagist.org/packages/socialiteproviders/duo)[ RSS](/packages/socialiteproviders-duo/feed)WikiDiscussions master Synced 3w ago

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

Duo SSO
=======

[](#duo-sso)

```
composer require socialiteproviders/duo
```

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

[](#installation--basic-usage)

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

### Prerequisites

[](#prerequisites)

Before you begin, you must have:

1. **Duo SSO configured** - You need a Duo Premier, Advantage or Essentials plan with Single Sign-On enabled
2. **OIDC Application created in Duo Admin Panel**:
    - Navigate to **Applications -&gt; Protect an Application**
    - Select **Generic OIDC Relying Party**
    - Configure your application and obtain the Client ID and Client Secret
3. **Duo SSO subdomain** - Your custom subdomain or the default one assigned to your account

Refer to the [Duo SSO for OIDC documentation](https://duo.com/docs/sso-oidc-generic) for detailed setup instructions.

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

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

```
'duo' => [
    'client_id' => env('DUO_CLIENT_ID'),
    'client_secret' => env('DUO_CLIENT_SECRET'),
    'redirect' => env('DUO_REDIRECT_URI'),
    'domain' => env('DUO_DOMAIN'), // Custom Duo SSO subdomain
],
```

### Add environment variables

[](#add-environment-variables)

Add these to your `.env` file:

```
DUO_CLIENT_ID=your_client_id_from_duo_admin_panel
DUO_CLIENT_SECRET=your_client_secret_from_duo_admin_panel
DUO_REDIRECT_URI=https://yourdomain.com/auth/duo/callback
DUO_DOMAIN=custom-subdomain.sso.duosecurity.com
```

**Note:** For the `DUO_DOMAIN`, you can use either:

- **Full domain**: `acme.sso.duosecurity.com`
- **Just subdomain**: `acme` (automatically becomes `acme.sso.duosecurity.com`)
- **Full URL**: `https://acme.sso.duosecurity.com`

### Add provider event listener

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

#### 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.

- Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.

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

Laravel 10 or below Configure the package's listener to listen for `SocialiteWasCalled` events.

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\Duo\DuoExtendSocialite::class.'@handle',
    ],
];
```

### Configure OIDC Application in Duo Admin Panel

[](#configure-oidc-application-in-duo-admin-panel)

When creating your Generic OIDC Relying Party application in Duo:

1. Navigate to **Applications -&gt; Application Catalog**
2. Search for "Generic OIDC Relying Party"
3. Click **Add** to create the application
4. Under **Scopes &amp; Claims**, configure:
    - Enable `openid` scope (required - provides `sub` claim)
    - Enable `profile` scope (provides `name`, `preferred_username`, `picture`, etc.)
    - Enable `email` scope (provides `email` claim)
    - Map each claim to the appropriate attribute from your authentication source

**About Claims:** Duo SSO acts as a bridge between your authentication source (AD/SAML/Duo Directory) and your application. The claims sent to your application come from the attributes in your authentication source. For example:

- `email` claim maps to the `` default attribute
- `name` claim maps to the `` default attribute
- Additional mappings can be configured in the Duo Admin Panel

For more information, see [Duo's OIDC documentation](https://duo.com/docs/sso-oidc-generic).

### Configure Redirect URI

[](#configure-redirect-uri)

In your Duo Admin Panel, add your callback URL to the OIDC application's allowed redirect URIs:

1. Navigate to your OIDC application in the Duo Admin Panel
2. Scroll to **Client Flow Configuration -&gt; Sign-In Redirect URLs**
3. Add: `https://yourdomain.com/auth/duo/callback`
4. Click **Save**

### 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('duo')->redirect();
```

### Callback Example

[](#callback-example)

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

Route::get('/auth/duo/callback', function () {
    $user = Socialite::driver('duo')->user();

    // $user->token
    // $user->id
    // $user->name
    // $user->email
});
```

### Returned User fields

[](#returned-user-fields)

The provider maps standard OpenID Connect claims to Socialite user fields. With the default scopes (`openid`, `profile`, `email`):

- `id` - User's unique identifier (from `sub` claim per OIDC spec)
- `nickname` - User's username (from `preferred_username` or `email` claim)
- `name` - User's full name (from `name` claim)
- `email` - User's email address (from `email` claim)
- `avatar` - User's profile picture URL (from `picture` claim)

**Note:** Duo SSO implements OpenID Connect and follows the [OpenID Connect Core 1.0 specification](https://openid.net/specs/openid-connect-core-1_0.html) for standard claims. The actual claims available depend on:

1. Which scopes you request (`openid`, `profile`, `email`, etc.)
2. The claim mappings configured in your Duo Admin Panel
3. The attributes available from your authentication source (Active Directory, SAML IdP or Duo Directory)

Duo SSO passes through the attributes from your authentication source to the OIDC claims based on your application's configuration.

### Optional: Custom Scopes

[](#optional-custom-scopes)

By default, the provider requests `openid`, `profile` and `email` scopes. You can customize these:

```
return Socialite::driver('duo')
    ->scopes(['openid', 'profile', 'email', 'groups'])
    ->redirect();
```

Available scopes depend on your Duo SSO OIDC application configuration in the Duo Admin Panel.

### Testing Integration

[](#testing-integration)

To see exactly which claims your Duo SSO instance returns:

```
Route::get('/auth/duo/callback', function (): void {
    $user = Socialite::driver('duo')->user();

    dd($user->getRaw());
});
```

This will show you all available claims from Duo's UserInfo endpoint for your specific configuration.

### Reference

[](#reference)

- [Duo Single Sign-On Documentation](https://duo.com/docs/sso)
- [Duo SSO for Generic OIDC](https://duo.com/docs/sso-generic-oidc)
- [Duo OAuth 2.1 and OIDC](https://duo.com/docs/sso-oauth-server)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance82

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

96d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/65eb3a7ba2a2c13b3a9de48b836caf759ad4052f9a839e30464c80d177d5b3d2?d=identicon)[atymic](/maintainers/atymic)

---

Top Contributors

[![rjp2525](https://avatars.githubusercontent.com/u/1334865?v=4)](https://github.com/rjp2525 "rjp2525 (1 commits)")

---

Tags

laraveloauthoauth1oauth2social-mediasocialitesocialite-providerslaravelprovideroauthsocialiteOpenIdoidcDuoduo-securityduo sso

### Embed Badge

![Health badge](/badges/socialiteproviders-duo/health.svg)

```
[![Health](https://phpackages.com/badges/socialiteproviders-duo/health.svg)](https://phpackages.com/packages/socialiteproviders-duo)
```

###  Alternatives

[socialiteproviders/apple

Apple OAuth2 Provider for Laravel Socialite

599.1M13](/packages/socialiteproviders-apple)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

24110.5k](/packages/kovah-laravel-socialite-oidc)[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

346.9M19](/packages/socialiteproviders-microsoft)[socialiteproviders/instagram

Instagram OAuth2 Provider for Laravel Socialite

401.9M5](/packages/socialiteproviders-instagram)[socialiteproviders/steam

Steam OpenID Provider for Laravel Socialite

20576.9k2](/packages/socialiteproviders-steam)

PHPackages © 2026

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