PHPackages                             socialiteproviders/onelogin - 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/onelogin

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

socialiteproviders/onelogin
===========================

Onelogin OAuth2 Provider for Laravel Socialite

5.2.0(1y ago)334.1k↑18.3%MITPHPPHP ^8.0

Since Jan 13Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/SocialiteProviders/Onelogin)[ Packagist](https://packagist.org/packages/socialiteproviders/onelogin)[ RSS](/packages/socialiteproviders-onelogin/feed)WikiDiscussions master Synced 1mo ago

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

Onelogin
========

[](#onelogin)

```
composer require socialiteproviders/onelogin
```

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

[](#installation--basic-usage)

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)

```
'onelogin' => [
  'base_url' => env('ONELOGIN_BASE_URL'),
  'client_id' => env('ONELOGIN_CLIENT_ID'),
  'client_secret' => env('ONELOGIN_CLIENT_SECRET'),
  'redirect' => env('ONELOGIN_REDIRECT_URI')
],
```

### 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('onelogin', \SocialiteProviders\Onelogin\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\Onelogin\OneloginExtendSocialite::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('onelogin')->redirect();
```

Store a local copy in your callback:

```
public function handleProviderCallback(\Illuminate\Http\Request $request)
{
    $user = Socialite::driver('onelogin')->user();
    $localUser = User::updateOrCreate(['email' => $user->email], [
        'email'         => $user->email,
        'name'          => $user->name,
        'token'         => $user->token,
        'id_token'      => $user->id_token,
        'refresh_token' => $user->refreshToken,
    ]);

    try {
        Auth::login($localUser);
    }
    catch (\Throwable $e) {
        return redirect('/login');
    }

    return redirect('/home');
}
```

Generate the logout url from your controller: NOTE:

```
public function logout(\Illuminate\Http\Request $request)
{
    $idToken = $request->user()->id_token;
    $logoutUrl = Socialite::driver('onelogin')->getLogoutUrl($idToken, URL::to('/'));
    Auth::logout();

    return redirect($logoutUrl);
}
```

#### Refresh Token

[](#refresh-token)

Using a refresh token allows an active user to maintain their session:

```
$localUser = Auth::user();
$response = (object) Socialite::driver('onelogin')
    ->setScopes(['offline_access'])
    ->getRefreshTokenResponse($localUser->refresh_token);

$localUser->token         = $response->access_token;
$localUser->refresh_token = $response->refresh_token;

$localUser->save();
Auth::setUser($localUser);
```

NOTE: obtaining a `refresh_token` requires the scope `offline_access` on the initial login.

#### Client Token

[](#client-token)

To obtain a client access token for authenticating to other apps without a user:

```
$response = (object) Socialite::driver('onelogin')->getClientAccessTokenResponse();
$token = $response->access_token;
```

NOTE: no caching of this token is performed. It's strongly suggested caching the token locally for its ttl

#### Revoke Token

[](#revoke-token)

Mark a token as revoked when checked against an introspection endpoint

```
$repo = Socialite::driver('onelogin');
$repo->revokeToken($token, 'access_token');
// verify against introspection endpoint
$state = $repo->introspectToken($token, 'access_token');
if($state['active']){...};
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance63

Regular maintenance activity

Popularity32

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~332 days

Total

3

Last Release

557d ago

PHP version history (2 changes)5.0.0PHP ^7.4 || ^8.0

5.1.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![lucasmichot](https://avatars.githubusercontent.com/u/513603?v=4)](https://github.com/lucasmichot "lucasmichot (12 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (3 commits)")[![amnuaycn](https://avatars.githubusercontent.com/u/115617221?v=4)](https://github.com/amnuaycn "amnuaycn (1 commits)")[![cosmastech](https://avatars.githubusercontent.com/u/42181698?v=4)](https://github.com/cosmastech "cosmastech (1 commits)")[![maks-oleksyuk](https://avatars.githubusercontent.com/u/90793591?v=4)](https://github.com/maks-oleksyuk "maks-oleksyuk (1 commits)")

---

Tags

laraveloauthoauth1oauth2social-mediasocialitesocialite-providerslaravelprovideroauthsocialiteoauth2oneligin

### Embed Badge

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

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

###  Alternatives

[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

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

Instagram OAuth2 Provider for Laravel Socialite

421.9M5](/packages/socialiteproviders-instagram)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

2073.7k](/packages/kovah-laravel-socialite-oidc)[socialiteproviders/kakao

Kakao OAuth2 Provider for Laravel Socialite

10484.7k4](/packages/socialiteproviders-kakao)

PHPackages © 2026

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