通过弹出窗口的 Twitter OAuth [英] Twitter OAuth via a popup

查看:39
本文介绍了通过弹出窗口的 Twitter OAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何通过弹出窗口进行 twitter OAuth,即在弹出窗口中加载 Oauth 页面并使回调关闭子窗口并重新加载父窗口.

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.

好的 iframe 很糟糕,但是您将如何完成上述操作,我注意到posterous.com 是这样做的 - 我希望实现与 FB connect 相同的流程.

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.

推荐答案

今天为雅虎做同样的事情...

Doing the same thing for Yahoo today...

  1. 打开一个弹出窗口
  2. 将用户发送到 Twitter 进行身份验证
  3. Twitter 将用户发送回 mysite.com/authcompleted.php,并在查询字符串中使用身份验证参数.仍然在此处的弹出窗口中.
  4. 弹出窗口 (mysite.com/authcompleted.html) 读取查询字符串并通过 javascript 将数据发送到 opener 窗口

  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)

window.opener.setTwitterAuthData(yourData)

在主窗口中的 setTwitterAuthData 中,设置适当的表单字段并将数据提交到您的服务器.

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

这篇关于通过弹出窗口的 Twitter OAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆