示例#1
0
        private void RequestAccessToken()
        {
            IRestRequest request = _client.Builder.PostOAuthToken(_auth.ClientId, _auth.ClientSecret,
                                                                  OAuthConfig.OAuthGrantTypes.AUTHORIZATION_CODE.Text, _auth.AuthorizationCode);
            ApiOAuthToken token = _client.Executor.DoSyncApiCall <ApiOAuthToken>(request, RequestType.PostOAuthToken);

            _auth.AccessToken  = token.AccessToken;
            _auth.RefreshToken = token.RefreshToken;
            _auth.UsedMode     = DracoonAuth.Mode.ACCESS_REFRESH_TOKEN;
        }
示例#2
0
 void IOAuth.RefreshAccessToken()
 {
     if (!string.IsNullOrWhiteSpace(_auth.RefreshToken))
     {
         IRestRequest request = _client.Builder.PostOAuthRefresh(_auth.ClientId, _auth.ClientSecret,
                                                                 OAuthConfig.OAuthGrantTypes.REFRESH_TOKEN.Text, _auth.RefreshToken);
         ApiOAuthToken token = _client.Executor.DoSyncApiCall <ApiOAuthToken>(request, RequestType.PostOAuthRefresh);
         _auth.AccessToken  = token.AccessToken;
         _auth.RefreshToken = token.RefreshToken;
     }
 }