Beispiel #1
0
        internal static Token RefreshToken(string refreshToken)
        {
            Global.Logger.Debug("GoogleDriveApp: refresh token");

            var query = String.Format("grant_type=refresh_token&client_id={0}&client_secret={1}&redirect_uri={2}&refresh_token={3}",
                                      ClientId, SecretKey, RedirectUrl, refreshToken);

            var json = PerformRequest(GoogleUrlToken, "application/x-www-form-urlencoded", "POST", query);

            return(Token.FromJson(json));
        }
Beispiel #2
0
        private static Token GetToken(string code)
        {
            var data = string.Format("code={0}&client_id={1}&client_secret={2}&redirect_uri={3}&grant_type=authorization_code",
                                     HttpUtility.UrlEncode(code),
                                     HttpUtility.UrlEncode(ClientId),
                                     HttpUtility.UrlEncode(SecretKey),
                                     RedirectUrl);

            var resultResponse = PerformRequest(GoogleUrlToken, "application/x-www-form-urlencoded", "POST", data);

            Global.Logger.Debug("GoogleDriveApp: token response - " + resultResponse);

            return(Token.FromJson(resultResponse));
        }