Connect a Windows Desktop app
With a few steps you can connect your Windows Forms or WPF application to The Identity Hub using OAuth.
A. Create an App
- Create an App for your Windows Desktop application. See Create an App for details.
B. Install Windows Desktop 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
C. Configure your Windows Desktop App.
- Navigate to the Apps list (https://www.theidentityhub.com/{tenant}/Admin/App) and select the application you are connecting.
- Open the Windows Desktop Apps section.
- Expand the section and copy the following information:
- Your ClientId
D. Using the Identity Service
We will now use the identityService to get info on the current user.
// Your ClientId
var clientId = {your ClientId};
// Your base URL
var baseUrl = new Uri({your tenant baseUrl in TIH});
// Initialize
var identityService = new IdentityService(clientId, baseUrl);
if(await identityService.TryAuthenticateAsync())
{
// Get profile info.
var profile = await identityService.GetProfileAsync();
}