public ActionResult STConnect(string auth) { auth = auth.Replace(" ", "+"); CommonRepository repo = new CommonRepository(); sTService = new STServices(); string JSON = string.Empty; string masterKey = WebConfigurationManager.AppSettings["SalezToolzMasterKey"]; string ClientSecret = WebConfigurationManager.AppSettings["SalezToolzClientSecret"]; // sTService.GetClientSecret(masterKey); string RealmID = string.Empty; string OAuthAccessToken = string.Empty; string OAuthAccessTokenSecret = string.Empty; string RedirectUrl = string.Empty; string AuthorizationKey = auth; int siteCoID = siteusercompanyid; string DisplayName = repo.GetUserDisplayName(siteuserid); string SalezToolzUserID = Convert.ToString(siteuserid); var RD = new { masterKey = masterKey, clientSecret = ClientSecret, authorizationKey = AuthorizationKey }; JSON = JsonConvert.SerializeObject(RD); Token AccessToken = sTService.GetAccessToken(JSON); if (AccessToken != null) { OAuthAccessToken = AccessToken.AccessToken; OAuthAccessTokenSecret = AccessToken.RefreshToken; // Inserting credential to Database. db.InsertSalezToolzOauth(siteCoID, SalezToolzUserID, DisplayName, null, OAuthAccessToken, OAuthAccessTokenSecret, DateTime.Now, RedirectUrl); } return(RedirectToAction("index")); }