PHPackages                             vippsas/vipps-craft-login - 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. vippsas/vipps-craft-login

ActiveCraft-plugin[Authentication &amp; Authorization](/categories/authentication)

vippsas/vipps-craft-login
=========================

Vipps Login Integration for CraftCMS

2.0.0(3y ago)01.8k↓100%2MITPHPPHP ^8.0

Since Nov 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/elleracompany/vipps-craft-login)[ Packagist](https://packagist.org/packages/vippsas/vipps-craft-login)[ RSS](/packages/vippsas-vipps-craft-login/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (10)Used By (0)

Vipps Login for Craft CMS
=========================

[](#vipps-login-for-craft-cms)

This plugin provides Vipps Login Integration for CraftCMS / CraftCommerce.

This plugin provides *Vipps Login Integration for Craft CMS / CraftCommerce*.

Description
-----------

[](#description)

This plugin is hosted at .

With *Vipps Login for Craft CMS* you can:

- Get information about users and visitors via Vipps
- Let users sign up and log in with Vipps
- Link their existing account to Vipps

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

- Sign up to use [Vipps Login](https://vipps.no/produkter-og-tjenester/bedrift/logg-inn-med-vipps/logg-inn-med-vipps/)
- Install the plugin via [Craft Plugin Store](https://plugins.craftcms.com)
- Configure the Settings

### Settings

[](#settings)

#### Find the Settings Page

[](#find-the-settings-page)

You can find the settings by navigating to *Settings* &gt; *Vipps Login*. [![Plugin Settings: Location](docs/images/settings_location.png)](docs/images/settings_location.png)

#### Add your credentials

[](#add-your-credentials)

Insert your credentials. You can find these in the [Vipps Portal](https://portal.vipps.no)[![Plugin Settings: Credentials](docs/images/settings_credentials.png)](docs/images/settings_credentials.png).

#### Activate Vipps Login and add the redirect URI

[](#activate-vipps-login-and-add-the-redirect-uri)

In the [Vipps Portal](https://portal.vipps.no), activate *Login with Vipps* and add the Redirect URI as you find it under *Redirect URIs* in either *Login with Vipps* and/or *Continue with Vipps*. Also adjust the scopes to suit your application's needs.

##### Setup Login

[](#setup-login)

[![Plugin Settings: Credentials](docs/images/portal_setup_login.png)](docs/images/portal_setup_login.png)

##### Add Redirect URIs

[](#add-redirect-uris)

[![Plugin Settings: Credentials](docs/images/portal_redirect_uris.png)](docs/images/portal_redirect_uris.png)

##### Locate Redirect URIs

[](#locate-redirect-uris)

[![Plugin Settings: Credentials](docs/images/settings_login.png)](docs/images/settings_login.png)[![Plugin Settings: Credentials](docs/images/settings_continue.png)](docs/images/settings_continue.png)

Rendering the button
--------------------

[](#rendering-the-button)

To render the login button anywhere, you can use the `loginButton.render()` function of the component the plugin registers.

*Note: All these options work for the `continueButton` as well.*

```
{{ craft.vippsLogin.loginButton.render() | raw }}
```

The button defaults to large (250px) rectangle formed button. If the language is not given by any of the language functions below and the current site language is `nb`, `nn`, `nb-NO` or `nn-NO`, the plugin will use Norwegian buttons. If no language is given and the current site language is something other than Norwegian, English buttons will be used.

The button can be modified by adding functions between `loginButton` and `render()`:

FunctionDescriptionExample`en` or `english`English text`craft.vippsLogin.loginButton.en.render()``no` or `norwegian`Norwegian text (Default)`craft.vippsLogin.loginButton.no.render()``pill`Pill shape`craft.vippsLogin.loginButton.pill.render()``rect` or `rectangle`Rectangle shape (Default)`craft.vippsLogin.loginButton.rect.render()``small`Small size, 210px`craft.vippsLogin.loginButton.small.render()``large`Large Size, 250px (Default)`craft.vippsLogin.loginButton.large.render()``continue`Change the login button to "Continue"`craft.vippsLogin.loginButton.continue.render()``login`Change the continue button to "Login"`craft.vippsLogin.continueButton.login.render()``register`Change the button to "Register"`craft.vippsLogin.continueButton.register.render()`These functions can be combined:

```
{{ craft.vippsLogin.loginButton.en.pill.small.render() | raw }}
```

You can also add parameters to the `` and `` tag by providing a string in the render function: `render(a, img)`

Append the `a` tag:

```
{{ craft.vippsLogin.loginButton.render('rel="external"') | raw }}
```

Append the `img` tag:

```
{{ craft.vippsLogin.loginButton.render(null, 'title="Login with Vipps" class="btn"') | raw }}
```

Append to both:

```
{{ craft.vippsLogin.loginButton.render('rel="external"', 'title="Login with Vipps" class="btn"') | raw }}
```

#### ReturnURL

[](#returnurl)

You can add a return URL by using the `returnUrl()` function. Or, you can manually add `?r=BASE64URL(yoururl)` to the end of the button link, should you need to dynamically update with JavaScript.

Rendering your own button
-------------------------

[](#rendering-your-own-button)

You can also call the function `craft.vippsLogin.getLoginUrl()` or `craft.vippsLogin.getContinueUrl()` to just get the URL.

```
Log in with Vipps
Continue with Vipps
```

Getting user information from Vipps
-----------------------------------

[](#getting-user-information-from-vipps)

As long as the user's Vipps token is not expired, you can access the user information with the session object.

```
{% if craft.vippsLogin.session %}
    Hi, {{ craft.vippsLogin.session.getGivenName }}!
{% else %}
    Not logged in
{% endif %}
```

### Attributes of the Session object

[](#attributes-of-the-session-object)

AttributeTypeDescription`isExpired`booleanIs the Vipps session valid`getExpiresIn`integerHow long til the Vipps session expires`getAddresses`arrayArray of registered addresses`getEmail`stringUser email`isEmailVerified`booleanIs the email verified`getGivenName`stringUsers given name`getFamilyName`stringUsers family name`getName`stringUsers full name`getPhoneNumber`stringUsers phone number`getSid`stringReturns the Session ID`getSub`stringUnique ID for this user`getNnin`stringReturns the Norwegian National Identification Number`getBirthdate`stringReturns the users birthdateShowing error messages
----------------------

[](#showing-error-messages)

This plugin utilizes `Craft::$app->session->setFlash()` for outputting error messages.

To show these messages in your template you need to look at the [documentation](https://docs.craftcms.com/api/v3/craft-web-session.html#public-methods) and implement something similar to this:

```
{% set messages = craft.app.session.getAllFLashes(true) %}
{% for key, message in messages %}

        {{ message }}

{% endfor %}
```

TypeDescriptionMessage`danger`Login failed in Vipps`error_description` from Vipps API`danger`Login failed in Vipps without message'Something went wrong while logging you in. Please try again, if the error persists contact the site administrator.'Using the "Automatic Return" flow option
----------------------------------------

[](#using-the-automatic-return-flow-option)

Before using this option, please read about the function and its security implications in [Automatic return from Vipps app](https://developer.vippsmobilepay.com/docs/APIs/login-api/api-guide/flows/automatic-return/).

Changing the Password Verification template
-------------------------------------------

[](#changing-the-password-verification-template)

When a user register/login with Vipps and an email that exists, they will be asked to confirm the password and the accounts will be linked.

If the setting under "Verification Template" under the "Log In with Vipps" tab is empty, our example template `vendor/vippsas/vipps-login-craft/src/templates/verify.twig` is used. To make your own, make a new twig file in your templates folder and update the setting.

If your template is located in `templates/vipps/verify` set the "Verification Template" option to `vipps/verify`. Use our example template to see the logic and forms that needs to be present.

Password verification and connecting to existing accounts
---------------------------------------------------------

[](#password-verification-and-connecting-to-existing-accounts)

When a user attempts to sign up with an email that already exist they are redirected to a password verification page. When they confirm their password the existing account is linked to the Vipps account and the user can log in using Vipps.

The password verification template provided by the plugin is just an example and can be found in `vendor/vippsas/src/templates/verify.twig`. Use this template as a starting point for implementing your own design. Update the field in `Settings -> Log In with Vipps -> Verification Template` with the new template path.

Ex. if your template is `templates/vipps/verification.twig` the settings field should be `vipps/verification`.

Events
------

[](#events)

The plugin triggers different events based on the user actions. These can be used to inject logic.

### Example code

[](#example-code)

```
use yii\base\Event;
use vippsas\login\events\LoggedInEvent;
use vippsas\login\VippsLogin;

...

Event::on(
    VippsLogin::class,
    VippsLogin::EVENT_USER_LOGGED_IN,
    function(LoggedInEvent $e) {
        // Implement your own logic here
        // using the $e variable to access
        // User and Session classes
        die(var_dump([
            'message' => 'User logged in',
            'user' => $e->getUser(),
            'session' => $e->getSession()
        ]));
    }
);
```

### Events summary

[](#events-summary)

EventNameFunctionsDescription`vippsas\login\events\LoggedInEvent``VippsLogin::EVENT_USER_LOGGED_IN``getUser()`, `getSession()`Triggers when a user is logged in with Vipps.`vippsas\login\events\ContinueEvent``VippsLogin::EVENT_USER_CONTINUED``getSession()`Triggers when a user continues with Vipps.`vippsas\login\events\RegisterEvent``VippsLogin::EVENT_USER_CREATED``getUser()`, `getSession()`Triggers when a user registers with Vipps.`vippsas\login\events\ConnectEvent``VippsLogin::EVENT_USER_CONNECTED_ACCOUNT``getUser()`, `getSession()`Triggers when a user connects an existing account to Vipps.### Example Code

[](#example-code-1)

Have a look at the twig template located [here](https://github.com/elleracompany/vipps-craft-login/blob/master/docs/examples/frontend.twig) for some usage examples. The twig template uses Bulma CSS from a CDN and should work right out of the box if the plugin is installed correctly.

How can I get help if I have any issues?
----------------------------------------

[](#how-can-i-get-help-if-i-have-any-issues)

For Craft-related issues you should use the resources and communities available on the [Craft CMS community website](https://craftcms.com/community).

For Plugin-related issues you should create a new issue in the [official repository](https://github.com/elleracompany/vipps-craft-login/issues).

For Vipps-related issues, you should contact [Vipps](https://developer.vippsmobilepay.com/).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~164 days

Recently: every ~196 days

Total

6

Last Release

1194d ago

Major Versions

1.0.2 → 2.0.02023-02-03

### Community

Maintainers

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

---

Top Contributors

[![jellingsen](https://avatars.githubusercontent.com/u/14084128?v=4)](https://github.com/jellingsen "jellingsen (36 commits)")[![p3ira](https://avatars.githubusercontent.com/u/74245570?v=4)](https://github.com/p3ira "p3ira (2 commits)")[![rebekaburnett](https://avatars.githubusercontent.com/u/104833234?v=4)](https://github.com/rebekaburnett "rebekaburnett (2 commits)")

---

Tags

AuthenticationloginCraftcraftcmsvipps

### Embed Badge

![Health badge](/badges/vippsas-vipps-craft-login/health.svg)

```
[![Health](https://phpackages.com/badges/vippsas-vipps-craft-login/health.svg)](https://phpackages.com/packages/vippsas-vipps-craft-login)
```

###  Alternatives

[born05/craft-twofactorauthentication

Craft 4 plugin for two-factor or two-step login using Time Based OTP.

36100.1k1](/packages/born05-craft-twofactorauthentication)[jamesedmonston/graphql-authentication

GraphQL authentication for your headless Craft CMS applications.

2917.0k](/packages/jamesedmonston-graphql-authentication)[matt-west/craft-recaptcha

Integrate Google’s reCAPTCHA into your forms.

1959.9k1](/packages/matt-west-craft-recaptcha)[acclaro/translations

Easily launch and manage multilingual Craft websites without having to copy/paste content or manually track updates.

1229.5k](/packages/acclaro-translations)[verbb/autologin

Automatically login based on whitelisted IP, basic auth username or URL keys.

161.8k](/packages/verbb-autologin)

PHPackages © 2026

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