private void LoadCloudABISToken() { try { CloudABISAPICredentials cloudABISCredentials = new CloudABISAPICredentials(); cloudABISCredentials.AppKey = AppKey(); cloudABISCredentials.SecretKey = SecretKey(); //AppSettingsReader.CloudABISSecretKey; cloudABISCredentials.BaseAPIURL = BaseURL(); //AppSettingsReader.CloudABIS_API_URL; cloudABISCredentials.CustomerKey = CustomerKey(); //AppSettingsReader.CloudABISCustomerKey; cloudABISCredentials.EngineName = EngineName(); if (!string.IsNullOrEmpty(cloudABISCredentials.BaseAPIURL) && !string.IsNullOrEmpty(cloudABISCredentials.SecretKey) && !string.IsNullOrEmpty(cloudABISCredentials.CustomerKey)) { //Read token from CloudABIS Server CloudABISConnector cloudABISConnector = new CloudABISConnector(cloudABISCredentials.AppKey, cloudABISCredentials.SecretKey, cloudABISCredentials.BaseAPIURL, cloudABISCredentials.CustomerKey, cloudABISCredentials.EngineName); CloudABISToken token = cloudABISConnector.GetCloudABISToken(); if (!string.IsNullOrEmpty(token.AccessToken)) { SessionManager.CloudABISAPIToken = token.AccessToken; SessionManager.CloudABISCredentials = cloudABISCredentials; } else { lblStatus.Text = "CloudABIS Not Authorized!. Please check credentails in the config file"; } } else { lblStatus.Text = "CloudABIS Not Authorized!. Please check credentails in the config file"; } } catch (Exception) { lblStatus.Text = "CloudABIS Not Authorized!. Please check credentails in the config file"; } }
private static bool InitCloudABIS() { //It could be coming from database, app configuration file or a secured source _cloudABISAPICredentials = new CloudABISAPICredentials { BaseAPIURL = "https://demo-fp.cloudabis.com/v1/", AppKey = "059d8c941ced41a4b11769908f237b31", SecretKey = "eNssBOV0dBxGCJDQaZrrVkzbwns=", CustomerKey = "1B2E60DA116D47E9B31AEFB0E5663A04" }; //Init CloudABIS API _cloudABISAPI = new CloudABISAPI(_cloudABISAPICredentials.AppKey, _cloudABISAPICredentials.SecretKey, _cloudABISAPICredentials.BaseAPIURL); _cloudABISToken = _cloudABISAPI.GetToken(); if (!string.IsNullOrEmpty(_cloudABISToken.AccessToken)) { return(true); } else { Console.WriteLine("CloudABIS token getting failed: " + _cloudABISToken.ErrorDescription); return(false); } }