In this topic you will get an overview how to use the Windows Desktop SDK to connect to The Identity Hub.
The Windows Desktop SDK supports Windows Forms and WPF applications.
To install the TheIdentityHub.WindowsDesktop NuGet package, run the following command in the Package Manager Console (Tools | Library Package Manager | Package Manager Console)
Install-Package TheIdentityHub.WindowsDesktop
// Your ClientId
var clientId = "";
// Your base URL
var baseUrl = new Uri("https://www.theidentityhub.com/{tenant}");
// Initialize
var identityService = new IdentityService(clientId, baseUrl);
if(await identityService.TryAuthenticateAsync())
{
// Continue
}
// Get profile info.
var profile = await identityService.GetProfileAsync();
// Get friends info.
var friends = await identityService.GetFriendsAsync();
Represents an account belonging to an identity.
Name | Value | Description |
---|---|---|
AccountId | System.String | Gets the account identifier |
DisplayName | System.String | Gets the display name. |
EmailAddress | System.String | Gets the email address. |
PictureUrl | System.String | Gets the picture URL. |
Represents an account provider.
Name | Value | Description |
---|---|---|
Accounts | TheIdentityHub.Account[] | Gets the accounts. |
DisplayName | System.String | Gets the display name. |
ProviderImageUrl | System.String | Gets the provider image URL. |
Represents a friend.
Name | Value | Description |
---|---|---|
DisplayName | System.String | Gets the display name of the friend. |
IdentityId | System.String | Gets the identifier of the friend. |
LargePictures | System.String[] | Gets the large pictures of the friend. |
MediumPictures | System.String[] | Gets the medium pictures of the friend. |
SmallPicture | System.String | Gets the first small picture of the friend. |
SmallPictures | System.String[] | Gets the small pictures of the friend. |
Provides methods to query an identity's profile.
Name | Description |
---|---|
IdentityService(string, Uri) | Initializes a new instance of the TheIdentityHub.IdentityService class for the given client indentifier and base URL |
Name | Value | Description | Remarks |
---|---|---|---|
BaseUrl | System.Uri | Gets the base URL. | |
ClientId | System.String | Gets the client identifier. | |
IsAuthenticated | System.Bool | Gets a value indicating whether this instance is authenticated. |
A value of false indicates the user needs to authenticate before the services
may be accessed. A value of true indicates the user has authenticated. However, authentication may be revoked at any point in time for a variety of reasons. |
Name | Description |
---|---|
GetAccessTokenAsync | Gets an access token for the current user asynchronously. |
GetAccountProvidersAsync | Gets the account providers. |
GetFriendsAsync | Gets the friends. |
GetProfileAsync | Gets the profile. |
GetRolesAsync | Gets the roles. |
RequireTwoFactorAuthenticationAsync | Indicates wether or not the user was authenticated using two-factor authentication. |
SignOut | Signs the current user out. |
TryAuthenticateAsync | Tries to authenticate the current user asynchronously. |
TryAuthenticateAsync(string) | Tries to authenticate the current user asynchronously. |
Represents an identity.
Name | Value | Description |
---|---|---|
DisplayName | System.String | Gets the display name of the identity. |
EmailAddress | System.String | Gets the email address of the identity. |
EmailAddressVerified | System.Bool | Gets a value indicating whether the email address of the identity has been verified. |
GivenName | System.String | Gets the name of the given of the identity. |
IdentityId | System.String | Gets the identifier of the identity. |
LargePictures | System.String[] | Gets the large pictures of the identity. |
MediumPictures | System.String[] | Gets the medium pictures of the identity. |
Picture | System.Uri | Gets the primary picture of the identity. |
SmallPictures | System.String[] | Gets the small pictures of the identity. |
Surname | System.String | Gets the surname of the identity. |
Represents a role.
Name | Value | Description |
---|---|---|
Name | System.String | Gets the name of the role. |