PHPackages                             devshaded/sparebank1-socialite-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. devshaded/sparebank1-socialite-provider

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

devshaded/sparebank1-socialite-provider
=======================================

0.0.1(1y ago)12MITPHPPHP ^8.1

Since Sep 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/DevShaded/laravel-socialite-sparebank1)[ Packagist](https://packagist.org/packages/devshaded/sparebank1-socialite-provider)[ RSS](/packages/devshaded-sparebank1-socialite-provider/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Socialite SpareBank 1
=============================

[](#laravel-socialite-sparebank-1)

This is a custom provider for OAuth login with [SpareBank1](https://www.sparebank1.no)

Installation
------------

[](#installation)

To install the package via composer, run the following command:

```
composer require devshaded/sparebank1-socialite-provider
```

Configuration
-------------

[](#configuration)

Once the package is installed, register the provider in `config/services.php` as follows:

```
'sb1' => [
    'client_id' => env('SB1_CLIENT_ID'),
    'client_secret' => env('SB1_CLIENT_SECRET'),
    'finInstId' => env('SB1_FIN_INST_ID'),
    'redirect' => env('SB1_REDIRECT_URI'),
],
```

Usage
-----

[](#usage)

To initiate the OAuth login with SpareBank1, you can use the following code to redirect users to the authentication page:

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

To handle the callback after the user has authenticated:

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

Environment Variables
---------------------

[](#environment-variables)

Ensure you have added the following variables to your `.env` file:

```
SB1_CLIENT_ID=your-client-id
SB1_CLIENT_SECRET=your-client-secret
SB1_REDIRECT_URI=your-redirect-url
SB1_FIN_INST_ID=fid-ringerike-hadeland
```

Replace your-client-id, your-client-secret, and your-redirect-url with the appropriate values from your SpareBank1 OAuth credentials.

Example
-------

[](#example)

```
Route::get('/oauth/redirect', function () {
    return Socialite::driver('sb1')->redirect();
});

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

    $existingUser = User::where('email', $user->getEmail())->first();

    if ($existingUser) {
        $existingUser->update([
            'firstname' => $user->user['firstname'],
            'lastname' => $user->user['lastname'],
            'email' => $user->getEmail(),
            'sub' => $user->user['sub'],
            'dob' => $user->user['dateOfbirth'],
            'phone' => $user->user['mobilePhoneNumber'],
        ]);

        $existingUser->accessToken()->update([
            'token' => $user->token,
            'refresh_token' => $user->refreshToken,
            'expires_in' => $user->expiresIn,
        ]);
    } else {
        $newUser = User::create([
            'firstname' => $user->user['firstname'],
            'lastname' => $user->user['lastname'],
            'email' => $user->getEmail(),
            'sub' => $user->user['sub'],
            'dob' => $user->user['dateOfbirth'],
            'phone' => $user->user['mobilePhoneNumber'],
        ]);

        $newUser->accessToken()->create([
            'token' => $user->token,
            'refresh_token' => $user->refreshToken,
            'expires_in' => $user->expiresIn,
        ]);
    }
});
```

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

608d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e32154ce9a5d4e502762536b540864069951ebc56a34c82e6d84f1dd0e5c5c81?d=identicon)[DevShaded](/maintainers/DevShaded)

---

Top Contributors

[![DevShaded](https://avatars.githubusercontent.com/u/49687450?v=4)](https://github.com/DevShaded "DevShaded (2 commits)")

### Embed Badge

![Health badge](/badges/devshaded-sparebank1-socialite-provider/health.svg)

```
[![Health](https://phpackages.com/badges/devshaded-sparebank1-socialite-provider/health.svg)](https://phpackages.com/packages/devshaded-sparebank1-socialite-provider)
```

###  Alternatives

[metrogistics/laravel-azure-ad-oauth

Provides single-sign-on ability to Microsoft Azure Active Directory enabled apps.

8679.1k1](/packages/metrogistics-laravel-azure-ad-oauth)[eveseat/web

SeAT Web Interface

2723.2k135](/packages/eveseat-web)

PHPackages © 2026

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