DotNet Core

Installation

Install the ITSME® NuGet package to your project to get started.

$ dotnet add <myproject> itsme

Import the ITSME® project into your code.

using Itsme;

Configuration

Initialize the ITSME® client with your configuration. Replace my_private_jwks.json with your actual key file by reading the content or adding it as a string.

var jwks = File.ReadAllText("jwks_private.json");
var settings = new ItsmeSettings();
settings.ClientId = "my_client_id";
settings.RedirectUri = "https://i/redirect";
settings.PrivateJwkSet = jwks;
var itsmeClient = new Client(settings);

Crafting an ITSME® redirect URL:

var urlConfig = new UrlConfiguration();
urlConfig.Scopes = new string[] { "email", "profile" };
urlConfig.ServiceCode = "my_service_code";
urlConfig.RequestUri = "";
var url = itsmeClient.GetAuthenticationURL(urlConfig);

Once generated, you can use this to redirect to itsme. After succesful authentication by the user, ITSME® will redirect to your configured backend url with an authorization code.

Exchanging the authorization_code

var user = itsmeClient.GetUserDetails("authorization_code");

The returned user contains all the information requested by you. Make sure to only use the sub identifier to link or reference an ITSME® user from your data as all other parameters can be subject to change.

As an extra means of flexibility, allow the update of the sub identifier for existing users as well. Due to security reasons, it can happen existing users are migrated to a new identifier, so for logged in users allow to update their ITSME® linked account.