Yoti 2.2.1
See the version list below for details.
dotnet add package Yoti --version 2.2.1
NuGet\Install-Package Yoti -Version 2.2.1
<PackageReference Include="Yoti" Version="2.2.1" />
paket add Yoti --version 2.2.1
#r "nuget: Yoti, 2.2.1"
// Install Yoti as a Cake Addin #addin nuget:?package=Yoti&version=2.2.1 // Install Yoti as a Cake Tool #tool nuget:?package=Yoti&version=2.2.1
Yoti .NET SDK
Welcome to the Yoti .NET SDK. This repo contains the tools and step by step instructions you need to quickly integrate your .NET back-end with Yoti so that your users can share their identity details with your application in a secure and trusted way.
Table of Contents
An Architectural view - High level overview of integration
Enabling the SDK - How to install our SDK
Client initialisation - Description on setting up your SDK
Profile retrieval - Description on setting up profile
Handling users - Description on handling user log on's
API Coverage - Attributes defined
Support - Please feel free to reach out
An Architectural View
To integrate your application with Yoti, your back-end must expose a GET endpoint that Yoti will use to forward tokens. The endpoint can be configured in Yoti Dashboard when you create/update your application.
The image below shows how your application back-end and Yoti integrate in the context of a Login flow. Yoti SDK carries out for you steps 6, 7 ,8 and the profile decryption in step 9.
Yoti also allows you to enable user details verification from your mobile app by means of the Android (TBA) and iOS (TBA) SDKs. In that scenario, your Yoti-enabled mobile app is playing both the role of the browser and the Yoti app. By the way, your back-end doesn't need to handle these cases in a significantly different way. You might just decide to handle the User-Agent
header in order to provide different responses for web and mobile clients.
Enabling the SDK
To install the Yoti NuGet package you will need to install NuGet. You can find instructions to do that here
To import the latest Yoti SDK into your project, enter the following command from NuGet Package Manager Console in Visual Studio:
Install-Package Yoti
For other installation methods, see nuget.org/packages/Yoti
To install the Yoti.Owin package, you can use:
Install-Package Yoti.Owin
Client Initialisation
The YotiClient is the SDK entry point. To initialise it you need include the following snippet inside your endpoint initialisation section:
const string sdkId = "your-sdk-id";
var privateKeyStream = System.IO.File.OpenText("path/to/your-application-pem-file.pem");
var yotiClient = new YotiClient(sdkId, privateKeyStream);
Where:
sdkId
is the sdk identifier generated by Yoti Dashboard when you create (and then publish) your app. Note this is not your Application Identifier which is needed by your clientside codepath/to/your-application-pem-file.pem
- When you create your app on Yoti Dashboard, your browser generates a .pem file. This is the path to that file.
You'll need to add the Callback URL
of your site to the integration settings section on your Yoti Applications page. This is where the user will be redirected to upon successful authentication. For the Example project, you should append /account/connect
to the end of this URL.
Profile Retrieval
When your application receives a token via the exposed endpoint (it will be assigned to a query string parameter named token
), you can easily retrieve the user profile by adding the following to your endpoint handler:
var activityDetails = yotiClient.GetActivityDetails(token);
Or if you are in an asynchronous method:
var activityDetails = await yotiClient.GetActivityDetailsAsync(token);
Before you inspect the user profile, you might want to check whether the user validation was successful. This is done as follows:
var activityDetails = yotiClient.GetActivityDetails(token);
if (activityDetails.Outcome == ActivityOutcome.Success)
{
var profile = activityDetails.UserProfile;
}
else
{
// handle unhappy path
}
Handling Users
When you retrieve the user profile, you receive a user ID generated by Yoti exclusively for your application. This means that if the same individual logs into another app, Yoti will assign her/him a different ID. You can use this ID to verify whether (for your application) the retrieved profile identifies a new or an existing user. Here is an example of how this works:
var activityDetails = yotiClient.GetActivityDetails(token);
if (activityDetails.Outcome == ActivityOutcome.Success)
{
var profile = activityDetails.UserProfile;
var user = YourUserSearchFunction(profile.Id);
if (user != null)
{
string userId = profile.Id;
Image Selfie = profile.Selfie;
string SelfieURI = profile.Selfie.Base64URI;
string FullName = profile.FullName;
string GivenNames = profile.GivenNames;
string FamilyName = profile.FamilyName;
string MobileNumber = profile.MobileNumber;
string EmailAddress = profile.EmailAddress;
DateTime? DateOfBirth = profile.DateOfBirth;
string Address = profile.Address;
string Gender = profile.Gender;
string Nationality = profile.Nationality;
}
else
{
// handle registration
}
}
else
{
// handle unhappy path
}
Where yourUserSearchFunction
is a piece of logic in your app that is supposed to find a user, given a userId.
No matter if the user is a new or an existing one, Yoti will always provide her/his profile, so you don't necessarily need to store it.
The profile
object provides a set of attributes corresponding to user attributes. Whether the attributes are present or not depends on the settings you have applied to your app on Yoti Dashboard.
Running the Example
- Open the Example.sln solution in Visual Studio, found in the /src folder
- Run the Example.csproj with your browser of choice
- The page should open automatically with URL
http://localhost:57045/Account/Login
API Coverage
- Activity Details
- Profile
- User ID
Id
- Selfie
Selfie
- Selfie URI
Selfie.Base64URI
- Given Names
GivenNames
- Family Name
FamilyName
- Full Name
FullName
- Mobile Number
MobileNumber
- Email Address
EmailAddress
- Age / Date of Birth
DateOfBirth
- Age / Verify Condition
age_[over|under]:[1-999]
- Postal Address
Address
- Gender
Gender
- Nationality
Nationality
- User ID
- Profile
Support
For any questions or support please email sdksupport@yoti.com. Please provide the following to get you up and working as quickly as possible:
- Computer type
- OS version
- Version of .NET being used
- Screenshot
Once we have answered your question we may contact you again to discuss Yoti products and services. If you’d prefer us not to do this, please let us know when you e-mail.
For further documentation, see https://www.yoti.com/developers/documentation/?csharp
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.6 is compatible. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- Google.Protobuf (>= 3.0.0)
- Newtonsoft.Json (>= 9.0.1)
- Portable.BouncyCastle (>= 1.8.1.1)
- System.Net.Http (>= 4.1.1)
-
.NETFramework 4.5.1
- Google.Protobuf (>= 3.0.0)
- Newtonsoft.Json (>= 9.0.1)
- Portable.BouncyCastle (>= 1.8.1.1)
- System.Net.Http (>= 4.1.1)
-
.NETFramework 4.5.2
- Google.Protobuf (>= 3.0.0)
- Newtonsoft.Json (>= 9.0.1)
- Portable.BouncyCastle (>= 1.8.1.1)
- System.Net.Http (>= 4.1.1)
-
.NETFramework 4.6
- Google.Protobuf (>= 3.0.0)
- Newtonsoft.Json (>= 9.0.1)
- Portable.BouncyCastle (>= 1.8.1.1)
- System.Net.Http (>= 4.1.1)
-
.NETFramework 4.6.1
- Google.Protobuf (>= 3.0.0)
- Newtonsoft.Json (>= 9.0.1)
- Portable.BouncyCastle (>= 1.8.1.1)
- System.Net.Http (>= 4.1.1)
-
.NETStandard 1.6
- Google.Protobuf (>= 3.0.0)
- NETStandard.Library (>= 1.6.0)
- Newtonsoft.Json (>= 9.0.1)
- Portable.BouncyCastle (>= 1.8.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Yoti:
Package | Downloads |
---|---|
Yoti.Sandbox
Yoti .NET SDK Sandbox |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.17.0 | 1,978 | 10/17/2024 |
3.16.0 | 34,500 | 5/14/2024 |
3.15.0 | 19,921 | 2/13/2024 |
3.14.0 | 25,433 | 4/21/2023 |
3.12.0 | 22,208 | 7/28/2022 |
3.11.0 | 5,878 | 5/3/2022 |
3.10.0 | 26,933 | 12/3/2021 |
3.9.0 | 5,294 | 3/23/2021 |
3.8.0 | 9,862 | 11/3/2020 |
3.7.0 | 1,281 | 10/21/2020 |
3.6.0 | 3,903 | 7/9/2020 |
3.5.1 | 1,742 | 6/4/2020 |
3.5.0 | 1,006 | 6/3/2020 |
3.4.0 | 1,157 | 4/16/2020 |
3.3.1 | 7,775 | 2/12/2020 |
3.3.0 | 1,565 | 1/6/2020 |
3.2.0 | 1,325 | 12/4/2019 |
3.1.0 | 1,625 | 10/23/2019 |
3.0.0 | 1,072 | 10/9/2019 |
2.8.0 | 2,500 | 10/30/2018 |
2.7.0 | 1,737 | 7/12/2018 |
2.6.0 | 1,654 | 6/6/2018 |
2.4.0 | 1,867 | 3/22/2018 |
2.3.0 | 1,397 | 3/13/2018 |
2.2.1 | 1,425 | 2/21/2018 |
2.2.0 | 1,510 | 10/23/2017 |
2.1.1 | 1,500 | 10/12/2017 |
2.1.0 | 1,597 | 10/3/2017 |