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 yesterday

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 21% of packages

Maintenance33

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

659d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49687450?v=4)[Fredrik](/maintainers/DevShaded)[@DevShaded](https://github.com/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

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[eveseat/web

SeAT Web Interface

2623.5k158](/packages/eveseat-web)

PHPackages © 2026

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