2

I am using @anywhere twitter API and I want to post a tweet using tweet box. I have done following steps:

I registered app and Consumer Key is as following. I left callback URL to empty.

  1. I have set Call Back URL while registering App is blank
  2. Consumer Key: 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>
    

and I am creating tweet box as following,

$(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 ?"
               });
           });
       });
   });

I am getting error after authentication Technical Problem. I am not able to tweet. Any help would be appreciated

arcain
  • 14,920
  • 6
  • 55
  • 75
  • Could be because of the markup or how the example is setup. Could you try to reproduce it on jsfiddle? – vsr Jul 03 '12 at 13:51

2 Answers2

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.

SynerCoder
  • 12,493
  • 4
  • 47
  • 78
0

I don't think you can use localhost addresses as callback URLs. Try the code after hosting it on a web server somewhere.

Munim
  • 6,310
  • 2
  • 35
  • 44