authenticating

Authentication is the very first and crucial step in using the ClearBlade C# API for your application. You will not be able to access any features of the ClearBlade platform without Authentication.

You will need to clone the following C# repository for using the ClearBlade services:
https://github.com/ClearBlade/CSharp-SDK/

There are two ways to authenticate to the ClearBlade platform:

Without Options

String SYSTEM_KEY = "your_systemkey";
String SYSTEM_SECRET = "your_systemsecret";


public static void InitCallback(bool success, string data)
{
	if (success)
	{
        //initialization successful
	}else
	{
		//initialization failed, given a ClearBladeException with the cause
    }
}

ClearBlade clearBlade = new ClearBlade();
clearBlade.initialize(SYSTEM_KEY, SYSTEM_SECRET, initCallback);

With Options

String SYSTEM_KEY = "your_systemkey";
String SYSTEM_SECRET = "your_systemsecret";
Dictionary<string, object> initOptions = new Dictionary<string, object>();

/**Available init options:
	 * 	email - String to register or log-in as specific user (required if password is given) Default - null
	 * 	password - password String for given user (required if email is given) Default - null
	 * 	platformURL - Custom URL for the platform Default - https://platform.clearblade.com
	 * 	messagingURL - Custom Messaging URL Default - tcp://messaging.clearblade.com:1883
	 * 	registerUser - Boolean to tell if you'd like to attempt registering the given user Default - false
	 * 	logging - Boolean to enable ClearBlade Internal API logging Default - false
	 * 	callTimeout - Int number of milliseconds for call timeouts Default - 30000 (30 seconds)
	 *  allowUntrusted - Boolean to connect to a platform server without a signed SSL certificate Default - false
*/

public static void InitCallback(bool success, string data)
{
	if (success)
	{
        //initialization successful
	}else
	{
		//initialization failed, given a ClearBladeException with the cause
    }
}

initOptions.Add("platfromURL", "https://staging.clearblade.com");
initOptions.Add("messageURL", "staging.clearblade.com");
initOptions.Add("email", "");
initOptions.Add("password", "");
initOptions.Add("registerUser", false);
initOptions.Add("logging", false);
initOptions.Add("callTimeout",30000);
initOptions.Add("allowUntrusted", false);

ClearBlade clearBlade = new ClearBlade();
clearBlade.initialize(SYSTEM_KEY, SYSTEM_SECRET, initOptions, initCallback);