public void Authorize()
        {
            if (ClientInfo == null)
            {
                throw new Exception("need clientInfo");
            }

            AuthorizedResponse authorizedResponse;

            if (!string.IsNullOrEmpty(RefreshToken))
            {
                authorizedResponse = GoogleOAuth.ExchangeRefreshToken(this.RefreshToken, this.ClientInfo);
            }
            else
            {
                string buildAuthUrl = GoogleOAuth.BuildAuthUrl(ClientInfo);
                string code         = GoogleOAuth.Authenticate(buildAuthUrl, ClientInfo);
                authorizedResponse = GoogleOAuth.ExchangeCode(code, ClientInfo);
            }

            this.AccessToken = authorizedResponse.AccessToken;

            if (authorizedResponse.RefreshToken != null && RefreshToken != authorizedResponse.RefreshToken)
            {
                RefreshToken = authorizedResponse.RefreshToken;
            }

            RefreshHeaders();
        }
        bool IsAuthorized()
        {
            if (!string.IsNullOrEmpty(this.AccessToken))
            {
                try {
                    ValidateTokenResponse validateTokenResponse = GoogleOAuth.ValidateToken(this.AccessToken);
                    return(string.IsNullOrEmpty(validateTokenResponse.Error));
                }
                catch (HttpRequestException) {
                    return(false);
                }
            }

            return(false);
        }