public static string By_VerificationCode(string ClientID, string Scope = null) { string URL = "https://www.dailymotion.com/oauth/authorize"; var parameters = new Dictionary <string, string>(); parameters.Add("response_type", ResponseType.code.ToString()); parameters.Add("client_id", ClientID); parameters.Add("redirect_uri", "https://unlimitedillegal.altervista.org/Dailymotion/app.html"); parameters.Add("display", "popup"); parameters.Add("scope", Scope); return(URL + Utilitiez.AsQueryString(parameters)); }
public static async Task <JSON_ExchangingVerificationCodeForToken> ExchangingVerificationCode_For_Token(string AuthorizationCode, string ClientID, string ClientSecret) { string URL = "https://www.dailymotion.com/oauth/authorize"; var parameters = new Dictionary <string, string>(); parameters.Add("grant_type", ResponseType.authorization_code.ToString()); parameters.Add("client_id", ClientID); parameters.Add("client_secret", ClientSecret); parameters.Add("redirect_uri", "https://unlimitedillegal.altervista.org/Dailymotion/app.html"); parameters.Add("code", AuthorizationCode); using (HtpClient localHttpClient = new HtpClient(new HCHandler())) { var HtpReqMessage = new HttpRequestMessage(HttpMethod.Post, new Uri(URL + Utilitiez.AsQueryString(parameters))); using (HttpResponseMessage response = await localHttpClient.SendAsync(HtpReqMessage, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false)) { string result = await response.Content.ReadAsStringAsync(); var TheRsult = JsonConvert.DeserializeObject <JSON_ExchangingVerificationCodeForToken>(result, JSONhandler); if (response.IsSuccessStatusCode) { return(TheRsult); } else { throw new DailymotionException(TheRsult._ErrorMessage, (int)response.StatusCode); } } } }
public pUri(string ApiAction, Dictionary <string, string> Parameters) : base(APIbase + ApiAction + Utilitiez.AsQueryString(Parameters)) { }