首页 文章

Aweber C#Api未经授权 - AccessToken密钥无效

提问于
浏览
2

我遇到了来自Aweber C#api的问题:http://aweber.codeplex.com/

我从以下代码获得了未经授权的响应 . 我想知道是否有人可以帮我看看我错过了什么?

String consumerKey = "####";
String consumerSecret = "####";

API api = new API(consumerKey, consumerSecret);

api.OAuthToken = "####";
api.OAuthTokenSecret = "####";
api.OAuthVerifier = "##";

Aweber.Entity.Account account = api.getAccount();

我假设我错过了一些重要的东西,但我无法弄清楚它是什么 .

在此先感谢您的帮助 .

D.

1 回答

  • 0

    您需要在api.getAccount()之前添加以下代码;

    // Set callback url (if not set will default to this page)
            api.CallbackUrl = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/Authorize.aspx";
    
            // Get request token
            api.get_request_token();
            // Save the token and secret in session 
            HttpContext.Current.Session.Add("oauth_token", api.OAuthToken);
            HttpContext.Current.Session.Add("oauth_token_secret", api.OAuthTokenSecret);
    
            // Will redirect user to the Aweber authorize page
            api.authorize();
    

相关问题