internal virtual void ModifyQueryString(QueryStringBuilder qsb) { foreach (var query in QueryStringParameters) { qsb.Add(query.Key, query.Value); } }
private static Uri GetAuthenticationUri(string clientId) { var queryStringBuilder = new QueryStringBuilder(); queryStringBuilder.Add("client_id", clientId); queryStringBuilder.Add("scope", string.Join(" ", (new [] { Scope.Basic, Scope.OfflineAccess, Scope.Signin, Scope.OneDriveReadWrite }).Select(s => s.GetDescription()))); queryStringBuilder.Add("redirect_uri", LIVE_LOGIN_DESKTOP_URI); queryStringBuilder.Add("response_type", "code"); queryStringBuilder.Add("display", "popup"); return new UriBuilder(LIVE_LOGIN_AUTHORIZE_URI) { Query = queryStringBuilder.ToString() }.Uri; }
private static async Task<AppTokenResponse> RedeemRefreshTokenAsync(string clientId, string clientSecret, string refreshToken) { var queryStringBuilder = new QueryStringBuilder(); queryStringBuilder.Add("client_id", clientId); queryStringBuilder.Add("redirect_uri", LIVE_LOGIN_DESKTOP_URI); queryStringBuilder.Add("client_secret", clientSecret); queryStringBuilder.Add("refresh_token", refreshToken); queryStringBuilder.Add("grant_type", "refresh_token"); string response = await PostQuery(LIVE_LOGIN_TOKEN_URI, queryStringBuilder); return JsonConvert.DeserializeObject<AppTokenResponse>(response); }