Twitter @anywhere login implementation


#1

Hello,

I’m new to Twitter @anywhere. Is @anywhere login feature is intended to integrate our website with Twitter login? just like Facebook connect?
If yes, What is the callback url used for and what callback url should be provided?

I’ve tried to add this @anywhere login feature to my site and I’m testing it from a localhost / 127.0.0.1 site. I use the following code

twttr.anywhere(function (T) {	
           T("#twitter-login").connectButton({
	   		authComplete: function(user) {
        		//triggered when auth completed successfully
                        alert('test login complete');

        		currentUser = T.currentUser;        		
				var userInfo = document.getElementById('user-info');
				userInfo.innerHTML = 
					'<img src="' + currentUser.data('profile_image_url') + '"/>' 
					+ currentUser.data('screen_name');									
      		}
	    });
});

If I don’t provide any callback url, after authorizing the user, Twitter give a

Sorry, something went wrong.
The provided callback url http://localhost:9000/ is not authorized for the client registered to 'http://127.0.0.1:9000'.

So then I provide a custom callback url with the following code twttr.anywhere.config({ callbackURL: “http://127.0.0.1:9000”});

After adding that code, no error occurred but I ended up having two tabs opened of the same page. One is the page I use to login and the other one is the callback url page. And also the code inside the “authComplete:” section is not run, the alert is not shown.

Did I do anything wrong?

Thank you


#2

You have to add http://127.0.0.1 to the list of authorized callback domains. Go to http://dev.twitter.com, sign in there, click your username on top right corner, go to “My applications”, choose your application, go to “@Anywhere domains” and add http://127.0.0.1 there.

Also, here is a blog-post about using @Anywhere with PHP Symfony, if you’re interested in.

It’s not 100% up-to-date, but still can provide you good perspective of how this works in general.

Regards,
Oleg


#3

Sorry, something went wrong.
Small_robot The provided callback url http%3A%2F%2Ffrenzdesign.com%2Ftweeter%2F is not authorized for the client registered to ‘http%3A%2F%2Fwww.frenzdesign.com%2Ftweeter.php’.

i am getting this error , can anyone help me for this error to solve ?