# Code example guide

Learn how to authenticate your end-users in just a few steps. You can use the Authentication API both to onboard new users and to authenticate registered users. This guide is designed to get you started quickly using the simplest use case, not to exhaustively cover everything the authentication solution can do. The back end is written in C# and the front end is written in React. The complete code example can be downloaded at the end of this guide.

See our API reference for detailed information about all the available endpoints and properties.

# 1. Install Signicat Express SDK

The easiest way to enable authentication in .NET is to use our SDK.

# Install via dotnet
dotnet add package Signicat.Express.SDK
dotnet restore
# Or install via NuGet
PM> Install-Package Signicat.Express.SDK

(Supports .NET Standard 2.0+, .NET Core 2.0+ and .NET Framework 4.6.1+)

# 2. Create a session

In the front end of your application, add an authentication button that calls a server-side endpoint to create an Identification Session.

const AuthDisplay = () => (
    <h1> Welcome to the authentication process </h1>
    <div className="auth">
      <form action="/authentication-session" method="POST">
        <button type="submit">
          Sign in

In the back end of your application, define an endpoint that creates the session for your frontend to call. You need these values:

  • Your ClientId, ClientSecret and Identity listed in the OAuthScope. (If you don't have an account already, you can make a free Signicat account here (opens new window))
  • A Flow property. Here it is set to Redirect that will redirect the end-user to one of the URLs specified. Alternative options are Iframe and headless flow that you can read more about here.
  • Your SuccessUrl, ErrorUrl and AbortUrl, specifies where the end-user will be redirected after they complete the Identification Session.
  • The Include property requests information about the end-user. Here we want to retrieve the Name and Nin (National identification number).
public class AuthenticationApiController : Controller
    private readonly IIdentificationV2Service _identificationService;
    private readonly string _frontendAppUrl;
    private readonly string _backendUrl;

    public AuthenticationApiController(IIdentificationV2Service identificationService, IConfiguration configuration)
        _identificationService = identificationService;
        _frontendAppUrl = configuration["FrontendAppUrl"];
        _backendUrl = configuration["BackendUrl"];

    public async Task<ActionResult> Create()
        var session = await _identificationService.CreateSessionAsync(new IdSessionCreateOptions()
            Flow = IdSessionFlow.Redirect,
            RedirectSettings = new RedirectSettings()
                ErrorUrl = _frontendAppUrl + "?error=true",
                AbortUrl = _frontendAppUrl + "?canceled=true",
                SuccessUrl = _backendUrl + "authentication-session"
            AllowedProviders = new List<IdProviderType>
            Include = new List<Include>()

        Response.Headers.Add("Location", session.Url);
        return new StatusCodeResult(303);

# 3. Complete the authentication process

After creating the Identification Session, redirect the end-user to the Url returned in the response in order to complete the authentication process. The end-user can choose one of the allowed identification methods (read more about the supported identification methods here).

Id selection screen Id selection screen

# 4. Retrieve user data

After the authentication process is complete and the user is redirected to the specified successUrl the session and associated user data can be retrieved:


public async Task<ActionResult> Retrieve([FromQuery(Name = "sessionId")] string sessionId)
    var result = await _identificationService.GetSessionAsync(sessionId);

    string name = result.Identity.FullName;
    string nin = result.Identity.Nin;

    var encodedName = Uri.EscapeDataString(name);

    Response.Headers.Add("Location", _frontendAppUrl + "?success=true&name=" + encodedName + "&nin=" + nin);
    return new StatusCodeResult(303);

# Download pre-built code example

The complete code example includes functionality such as specifying identification methods, UI settings and handling information flow to the frontend. Please note that the example is built to be easy to understand and best practice is not always followed (e.g. sending National identification number in the URL).

Or check out our GitHub page: (opens new window).

# Video tutorial with walkthrough of Dashboard and MitID

Questions, comments, or suggestions? Check out our community (opens new window).

Last updated: 06/12/2021 14:13 UTC