Windows Desktop SDK

Summary

In this topic you will get an overview how to use the Windows Desktop SDK to connect to The Identity Hub.

Contents

  • Installing the SDK
  • Initialize the Identity Service
  • Authenticate
  • Getting Profile Information
  • Getting Friends Information
  • Api

The Windows Desktop SDK supports Windows Forms and WPF applications.

Installing the SDK

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
 

Initialize the Identity Service


// Your ClientId
var clientId = "";
// Your base URL
var baseUrl = new Uri("https://www.theidentityhub.com/{tenant}");
// Initialize
var identityService = new IdentityService(clientId, baseUrl);
                     

Authenticate


if(await identityService.TryAuthenticateAsync())
{
    // Continue
}
                     

Getting Profile Information


// Get profile info.
var profile = await identityService.GetProfileAsync();
                     

Getting Friends Information


// Get friends info.
var friends = await identityService.GetFriendsAsync();
                     

Api

TheIdentityHub.Account

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.

TheIdentityHub.AccountProvider

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.

TheIdentityHub.Friend

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.

TheIdentityHub.IdentityService

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.

TheIdentityHub.Profile

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.

TheIdentityHub.Role

Represents a role.

Name Value Description
Name System.String Gets the name of the role.