public string GetAuthToken() { string response; try { GetoAuth getoAuth = new GetoAuth(); response = getoAuth.GetoAuthToken(); } catch (Exception Ex) { throw Ex; } return(response); }
public string GetAccessToken(CallbackResponseModel callbackResponse) { string response; try { GetoAuth getoAuth = new GetoAuth(); response = getoAuth.GetAccessToken(callbackResponse); } catch (Exception Ex) { throw Ex; } return(response); }
public string makeAuthenticationURI(string Requeststring, AddEventRequest request) { string URLResult = string.Empty; string base_uri = URLConstants.AddEventToVenueURL; GetoAuth getoAuth = new GetoAuth(); var time = Math.Floor(getoAuth.GetTime() / 1000.0); string timeStamp = Convert.ToString(time); string Nonce = getoAuth.GenerateNonce(); string parameters = "app_key=" + URLConstants.APIKey + "&oauth_consumer_key=" + URLConstants.APIconsumerKey + "&oauth_nonce=" + Nonce + "&oauth_signature_method=HMAC-SHA1" + "&oauth_timestamp=" + timeStamp + "&oauth_token=" + request.oauth_token + "&oauth_version=1.0&" + Requeststring; if (parameters.IndexOf(request.start_time) > 0) { URLResult = getoAuth.EscapeDataStingURI(request.start_time); parameters = parameters.Replace(request.start_time, URLResult); } if (parameters.IndexOf(request.description) > 0) { URLResult = getoAuth.EscapeDataStingURI(request.description); parameters = parameters.Replace(request.description, URLResult); } if (parameters.IndexOf(request.title) > 0) { URLResult = getoAuth.EscapeDataStingURI(request.title); parameters = parameters.Replace(request.title, URLResult); } string[] Data = parameters.Split('&'); Array.Sort(Data, StringComparer.InvariantCultureIgnoreCase); parameters = ""; for (int i = 0; i < Data.Length - 1; i++) { parameters = parameters + Data[i] + "&"; } parameters = parameters + Data[Data.Length - 1]; string signature_base_string = getoAuth.GetSignatureBaseString(base_uri, parameters, "get"); string signature = getoAuth.GetSha1Hash(URLConstants.APISecretKey + "&" + request.oauth_token_secret, signature_base_string); Console.WriteLine(signature); parameters = "app_key=" + URLConstants.APIKey + "&oauth_consumer_key=" + URLConstants.APIconsumerKey + "&oauth_nonce=" + Nonce + "&oauth_signature=" + signature + "&oauth_signature_method=HMAC-SHA1" + "&oauth_timestamp=" + timeStamp + "&oauth_token=" + request.oauth_token + "&oauth_version=1.0&" + Requeststring; if (parameters.IndexOf(request.start_time) > 0) { URLResult = getoAuth.EscapeDataStingURI(request.start_time); parameters = parameters.Replace(request.start_time, URLResult); } if (parameters.IndexOf(request.description) > 0) { URLResult = getoAuth.EscapeDataStingURI(request.description); parameters = parameters.Replace(request.description, URLResult); } if (parameters.IndexOf(request.title) > 0) { URLResult = getoAuth.EscapeDataStingURI(request.title); parameters = parameters.Replace(request.title, URLResult); } Data = parameters.Split('&'); Array.Sort(Data, StringComparer.InvariantCultureIgnoreCase); parameters = ""; for (int i = 0; i < Data.Length - 1; i++) { parameters = parameters + Data[i] + "&"; } parameters = parameters + Data[Data.Length - 1]; URLResult = base_uri + "?" + parameters; Console.WriteLine(URLResult); return(URLResult); }