public IAuthorizationState RequestAccessToken(string refreshToken)
        {
            {
                WebServerClient consumer = new WebServerClient(ServerDescription, ClientID, ClientSecret)
                {
                    AuthorizationTracker = new AuthorizationTracker(Scope)
                };

                IAuthorizationState grantedAccess = PrepareAuthorizationState(refreshToken);

                if (grantedAccess != null)
                {
                    try
                    {
                        consumer.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(ClientSecret);
                        consumer.RefreshAuthorization(grantedAccess, null);

                        return grantedAccess;
                    }
                    catch (Exception ex)
                    {
                        log.Error("RefreshAuthorization() Exception:\r\n{0}\r\n", ex.ToString());
                    }
                }

                return null;
            }
        }
        public ViewResult RefreshToken(RefreshTokenViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                try
                {
                    // Create the client with which we will be connecting to the server.
                    var webServerClient = new WebServerClient(this.AuthorizationServerDescription, clientIdentifier: model.ClientId, clientSecret: model.ClientSecret);

                    // Create an AuthorizationState instance with only the refresh token set. This is all that is needed for
                    // OAuth to be able to determine what token is to be refreshed
                    var authorizationState = new AuthorizationState { RefreshToken = model.RefreshToken };

                    // Refresh an access token (http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-6)
                    // This method will use the client identifier and client secret used when constructing the WebServerAgentClient instance
                    webServerClient.RefreshAuthorization(authorizationState);

                    this.ViewBag.AccessToken = authorizationState;
                }
                catch (Exception ex)
                {
                    this.ViewBag.Exception = ex;
                }
            }

            return this.View(model);
        }