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.

4

1 回答 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();
于 2013-12-16T06:03:59.273 回答