2

我正在使用@anywhere twitter API,我想使用推文框发布推文。我已经完成了以下步骤:

我注册的应用程序和消费者密钥如下。我将回调 URL 留空。

  1. 我在注册应用程序时设置了回调 URL 为空白
  2. 消费者密钥:94zA1u34whtdXz91Kjymgw

    <script src="http://platform.twitter.com/anywhere.js?id=94zA1u34whtdXz91Kjymgw&v=1" type="text/javascript">
    </script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.js">
    </script>
    

我正在创建如下推文框,

$(document).ready(function () {
       $('#shareonTwitter').click(function (e) {
           alert('hello1234567');
           twttr.anywhere.config({ callbackURL: "http://localhost:1461/ShareonTwitter.html" });
           twttr.anywhere(function (T) {
               T("#tbox").tweetBox({
                   height: 100,
                   width: 400,
                   defaultContent: "Hi how r u ?"
               });
           });
       });
   });

身份验证技术问题后出现错误。我无法发推文。任何帮助,将不胜感激

4

2 回答 2

1

I read myself a little into the documentation and I found the following:

Please note: The call to twttr.anywhere.config() must precede the call to twttr.anywhere(). And the callback URL must match both the subdomain and domain of the web application utilizing @Anywhere.

Authorizing Additional Domains for @Anywhere

Some implementors may want their @Anywhere API Key to function across multiple domains or subdomains. By default, @Anywhere will only work with the domain specified in the "Callback URL" field of the application record.

To authorize additional domains for @Anywhere, begin by going to your applications, and clicking on the @Anywhere application name you want to configure. Now select Manage Domains from the right-hand sidebar.

You can enter up to 5 additional domains here, by typing a domain name you want to authorize in the field provided and clicking Authorize. Be sure and only authorize domains that you trust.

https://dev.twitter.com/docs/anywhere/welcome#custom-callback

Any callback url must be in your authored domains. This means that you must had localhost in your domain list. Since you can't register localhost with you api/consumer key you can't do this on localhost.

于 2012-07-03T15:00:06.070 回答
0

我认为您不能将本地主机地址用作回调 URL。将代码托管在某处的 Web 服务器上后尝试该代码。

于 2012-07-03T13:27:03.417 回答