Twitter OAuth via a popup

独自空忆成欢 提交于 2019-12-18 10:07:10

问题


I was wondering how to do twitter OAuth via a popup, i.e. load up the Oauth page in a popup and make the callback close the child window and reload the parent window.

Edit: OK iframes are bad, but how would you accomplish the above, I notice posterous.com does this - I'm looking to achieve the same flow as FB connect.


回答1:


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.




回答2:


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.




回答3:


This maybe helpful!

http://zuzara.com/blog/2010/05/15/jquery-plugin-for-twitter-oauth-via-popup-window-facebook-style/



来源:https://stackoverflow.com/questions/1878529/twitter-oauth-via-a-popup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!