jjzjj

php - 来自外部应用程序的 OpenSocial 身份验证

coder 2024-04-15 原文

我正在从事一个与 power.com 在原则上并无太大不同的 Web 项目,我试图在一个网站下统一几个不同的社交网站,允许用户在系统中注册一次,然后添加尽可能多的个人社交网络帐户(Facebook、MySpace、Orkut 等)作为系统专为处理而设计,允许他们在一个地方浏览各自的个人资料信息。

简而言之,我似乎无法找到一种方法来对任意用户的社交网络帐户进行身份验证。

我一直在研究 OpenSocial 规范以及 OpenSocial PHP client项目,但我似乎遗漏了一些东西,因为一切似乎都是循环依赖的。

我的第一个问题是,出于测试目的,我有一个 MySpace 消费者 key 和消费者 secret ,但是每当我尝试使用 MySpace 执行三方身份验证时,没有以其他人身份登录的选项。此外,它执行外部重定向,这有点不受欢迎(作为这个最终社交网络“门户”的用户,我宁愿不必在每次添加新帐户时都经历该重定向过程)。

我如何以编程方式验证任意用户并允许他们访问他们的帐户信息(最好没有外部重定向)?

其次,双足身份验证需要一个 userId(通常是任意整数)来标识要为其检索信息的任意用户。但是,当我输入我的 MySpace OpenSocial ID 以及给定的消费者 key 和消费者 secret 时,我收到 401 拒绝访问错误。此外,为了将来使用此 ID,我似乎需要先对用户进行身份验证……但该身份验证似乎需要 ID。

我非常确信我遗漏了一些微不足道的东西,但我终究无法弄清楚它是什么。非常感谢您的帮助!

最佳答案

从技术上讲,这不是我的答案,但 OpenSocial 的开发人员为我提供了有关我的问题(强调我的)的以下信息:

3-legged OAuth is built around the redirect back to the site you're authenticating with, and there's no way to avoid it. It's not the most convenient experience, but allows users to share their data with your website while keeping their passwords private. Any design which requires users to enter their MySpace password into a form on your website is considered an anti-pattern and should be avoided. You could potentially attempt the redirect in a popup window in order to make the experience a bit less jarring for the user (currently the PHP client doesn't make this that easy, but if you followed up at opensocial-client-libraries@googlegroups.com someone could help you work through that process).

With regard to not being able to change the user, what I believe MySpace is doing in your case is checking for a MySpace cookie and pre-populating your account information. If you were a user visiting the site and not logged into MySpace, you should get a full username/login box combination. There should also be a button or link somewhere to say "I'm not this user" and log in with other credentials.

As for 2-legged, you would need to have the application associated with the consumer key/secret installed on the profile of any user whose data you wish to access. 2-legged is mostly intended for developers who are currently running a social gadget on a container and wish to access social data for their application users out of band with a gadget render. In this case, the application server would already have the user's OpenSocial ID (from a signed makeRequest) and the user would already have the app installed on their MySpace profile).

Most of this is covered in http://wiki.opensocial.org/index.php?title=OAuth_Use_Casesif you want more information.

从本质上讲,这使得在外部应用程序上使用任何 2-legged 身份验证变得不可能;两条腿被明确设计为不在这种情况下使用。此外,似乎 power.com 确实采用了让用户提供他们实际的 Orkut/MySpace/etc 凭据的反模式,所以这就解释了这一点。

清除我的 cookie 有助于通过 MySpace 验证我的身份。但是,我接着提出了另一个关于 Orkut 身份验证如何工作的问题,因为它似乎不支持三足身份验证。这是我收到的回复:

Orkut is interested in supporting this, so you'll be able to allow users to share their information with your application "correctly" in the future.

The corresponding two-legged app would need to forward the current viewer's OpenSocial ID back to your server, probably along with an authorization token you generate yourself so that you can link a user's session on orkut with a session on your own server. Honestly, it's probably not usable enough to support a standalone login system.

本质上,不,如果不求助于反模式,Orkut 真的无法连接到外部应用程序(至少目前还不能)。

如果有人对此主题有任何进一步的信息,请随时分享!

关于php - 来自外部应用程序的 OpenSocial 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1604799/

有关php - 来自外部应用程序的 OpenSocial 身份验证的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby-on-rails - 如何验证 update_all 是否实际在 Rails 中更新 - 2

    给定这段代码defcreate@upgrades=User.update_all(["role=?","upgraded"],:id=>params[:upgrade])redirect_toadmin_upgrades_path,:notice=>"Successfullyupgradeduser."end我如何在该操作中实际验证它们是否已保存或未重定向到适当的页面和消息? 最佳答案 在Rails3中,update_all不返回任何有意义的信息,除了已更新的记录数(这可能取决于您的DBMS是否返回该信息)。http://ar.ru

  3. ruby - 具有身份验证的私有(private) Ruby Gem 服务器 - 2

    我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..

  4. ruby - 将差异补丁应用于字符串/文件 - 2

    对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl

  5. ruby - 如何指定 Rack 处理程序 - 2

    Rackup通过Rack的默认处理程序成功运行任何Rack应用程序。例如:classRackAppdefcall(environment)['200',{'Content-Type'=>'text/html'},["Helloworld"]]endendrunRackApp.new但是当最后一行更改为使用Rack的内置CGI处理程序时,rackup给出“NoMethodErrorat/undefinedmethod`call'fornil:NilClass”:Rack::Handler::CGI.runRackApp.newRack的其他内置处理程序也提出了同样的反对意见。例如Rack

  6. ruby - 在 Ruby 中编写命令行实用程序 - 2

    我想用ruby​​编写一个小的命令行实用程序并将其作为gem分发。我知道安装后,Guard、Sass和Thor等某些gem可以从命令行自行运行。为了让gem像二进制文件一样可用,我需要在我的gemspec中指定什么。 最佳答案 Gem::Specification.newdo|s|...s.executable='name_of_executable'...endhttp://docs.rubygems.org/read/chapter/20 关于ruby-在Ruby中编写命令行实用程序

  7. ruby-on-rails - 如果为空或不验证数值,则使属性默认为 0 - 2

    我希望我的UserPrice模型的属性在它们为空或不验证数值时默认为0。这些属性是tax_rate、shipping_cost和price。classCreateUserPrices8,:scale=>2t.decimal:tax_rate,:precision=>8,:scale=>2t.decimal:shipping_cost,:precision=>8,:scale=>2endendend起初,我将所有3列的:default=>0放在表格中,但我不想要这样,因为它已经填充了字段,我想使用占位符。这是我的UserPrice模型:classUserPrice回答before_val

  8. ruby-on-rails - Rails 应用程序之间的通信 - 2

    我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此

  9. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  10. ruby-on-rails - Rails 应用程序中的 Rails : How are you using application_controller. rb 是新手吗? - 2

    刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr

随机推荐