Xamarin Windows SDK
The following things are to be kept in mind while integrate our cidaas sdk
Configuring App/Client:
When you are integrating your own Business App with cidaas, you may want to modularize the interactions and attributes. There are several information like Scope, Roles, Grant-Types, re-direct URLs etc., that you may want to group into one configuration/settings. This can be done by creating cidaas App or Client.
The steps here will guide you through set up and management of authentication and authorization in your apps using cidaas Xamarin Windows SDK.
Click here for Sample Project.
Requirements
Visual Studio : 2017 Operating System : Windows 10
Installation
cidaas-sdk-windows-v2 is available through NuGet. There are 3 options to integrate it in your project
1 . Enter the following command in Package Manager Console
Install-Package cidaas-sdk-windows-v2
2 . Download the package from the following url
https://www.nuget.org/packages/cidaas-sdk-windows-v2
Once downloaded, drag and drop the file to your project
3 . Right click on your project and select Add Nuget Packages option. Search for cidaas-sdk-windows-v2 and install it
Getting Started
1 . Create a Webview in your XAML file
2 . Initialise the cidaas SDK with the webview
Cidaas cidaas = new Cidaas(webview);
3 . Initialise the URLs for the cidaas
cidaas.SetURL("your base url", "your client id", "your redirect url");
Login
4 . To get the login URL, call GetLoginURL()
cidaas.GetLoginURL();
5 . To perform login operation, copy and paste the below code snippet
cidaas.Login((token_response, exception) => {
if (exception != null) {
// Handle your exception
}
else {
// Handle success response
string token = token_response.access_token;
}
});
Registration
6 . To get the registration URL, call GetRegisterURL()
cidaas.GetRegisterURL();
7 . To perform register operation, copy and paste the below code snippet
cidaas.Register((token_response, exception) => {
if (exception != null) {
// Handle your exception
}
else {
// Handle success response
string token = token_response.access_token;
string sub = token_response.sub
}
});
Getting User Information
8 . To get user information, call GetUserInfo() method
cidaas.GetUserInfo(token, (user_info_response, exception) => {
if (exception != null) {
// Handle your exception
}
else {
// Handle success response
string given_name = user_info_response.given_name;
}
});
Getting Access token
9 . To validate access token, call GetAccessToken() method
cidaas.GetAccessToken(sub, (token_response, exception) => {
if (exception != null) {
// Handle your exception
}
else {
// Handle success response
string token = token_response.access_token;
string sub = token_response.sub
}
});
Logout user
To logout the session, call Logout() method
cidaas.Logout(sub);
Screen Shots