Skip to main content

Vipps Login for ASP.NET and Optimizely

Support and development by Geta Support and development by Geta

Vipps Available for Vipps.

MobilePay Not available for MobilePay.

This plugin is built and maintained by Geta and is hosted on GitHub. For support, submit an issue on GitHub.

Please keep up-to-date with updates as soon as they happen.

Description

This repository contains the code to use Vipps Log In OpenIdConnect (OIDC) Authentication middleware in your ASP.NET application using OWIN.

This repository consists of three NuGet packages:

  • Vipps.Login - OWIN Middleware that enables an application to use OpenIdConnect for authentication.
  • Vipps.Login.Episerver - Episerver code for Vipps Login.
  • Vipps.Login.Episerver.Commerce - Episerver Commerce code for Vipps Login.

For more information, about login, see the Login API guide.

Note that Optimizely was previously called Episerver.

Features

  • OWIN Middleware to support Vipps Login through OpenIdConnect
  • Library to simplify Episerver configuration and set up

How to get started?

Start by installing the NuGet packages:

For the OWIN middleware

  • Install-Package Vipps.Login

And for the Episerver extensions

  • Install-Package Vipps.Login.Episerver
  • Install-Package Vipps.Login.Episerver.Commerce

Get API keys for Vipps Log In API

Activate and set up Vipps Login.

Configure a redirect URI to your site(s): https://{your-site}/vipps-login. Replace {your-site} with your own host name. It can be localhost, as well.

To use the VippsLoginConfig helper class, add the ClientId and the ClientSecret to the Web.Config AppSettings, as such:

<add key="VippsLogin:ClientId" value="..." />
<add key="VippsLogin:ClientSecret" value="..." />
<add key="VippsLogin:Authority" value="https://apitest.vipps.no/access-management-1.0/access" />

For production, use:

<add key="VippsLogin:Authority" value="https://api.vipps.no/access-management-1.0/access" />

See Vipps test server to find the default configuration for the Vipps OIDC middleware.

Configuration

Now you can configure your ASP.NET or Episerver application:

Accessing Vipps user data

The Vipps UserInfo can be accessed by using the GetVippsUserInfo(IIdentity identity) method on IVippsLoginService. This will give you the most recent user info that was retrieved when the user logged in (cached, stored as claims on the identity).

public class AccountController : Controller
{
private readonly IVippsLoginService _vippsLoginService;
public AccountController(IVippsLoginService vippsLoginService)
{
_vippsLoginService = vippsLoginService;
}

public ActionResult Index()
{
var userInfo = _vippsLoginService.GetVippsUserInfo(User.Identity)
...
}
}

More info

Package maintainer

Brian Weeteling

Changelog

See Changelog.

Support

For problems with the plugin, submit an issue on GitHub.

Help us improve our documentation

Did you find what you were looking for?