Twitter OAuth via a popup Twitter OAuth via a popup javascript javascript

Twitter OAuth via a popup


Doing the same thing for Yahoo today...

  1. Open a popup
  2. Send user to twitter for authentication
  3. Twitter sends user back to mysite.com/authcompleted.php, with authentication parameters in the query string. Still in the popup here.
  4. The popup (mysite.com/authcompleted.html) reads the query string and sends the data to the opener window via javascript

    window.opener.setTwitterAuthData(yourData)

  5. Inside setTwitterAuthData, which is in your main window, set appropriate form fields and submit the data to your server.


You shouldn't do this. Loading it in an IFrame hides the URL from the user, making it difficult for them to confirm that they're entering their password on twitter.com and not a third-party (i.e. phishing) site.