Rails 3.0.9 + open_id_authentication [英] Rails 3.0.9 + open_id_authentication

查看:81
本文介绍了Rails 3.0.9 + open_id_authentication的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用open_id_authentication gem对Google进行身份验证.在会话控制器中,我打电话

I'm using open_id_authentication gem to authenticate to google. In my sessions controller I call

authenticate_with_open_id(complete_identity_url, OPENID_OPTS) do |openid_result, identity_url, registration|

,它返回401状态码未经身份验证.但是它应该显示我必须在其中确认访问权限的google页面.

and it returns 401 status code Unauthenticated. But it should show google page in which I must confirm access.

我制作了示例应用程序: https://github.com/mbashirov/rails3-test ,它仅在会话控制器和路由中设置了代码.

I made example app: https://github.com/mbashirov/rails3-test, it only has code in sessions controller and routes set.

该代码可在Rails 2.3应用程序上完美运行.有错误吗?

That code works perfectly on rails 2.3 app. There is error?

谢谢.

解决方案.

在会话控制器中添加

class SessionsController < ApplicationController
  include OpenIdAuthentication

在config/application.rb中添加

In config/application.rb add

config.app_middleware.use OpenIdAuthentication

经过这两个步骤,一切正常.

After this two steps all works fine.

推荐答案

如果它在2.3中可用,而在3中不起作用,则听起来像是一个错误,并非由您自己制作.

If it works in 2.3 and then doesn't work in 3, it sounds like an error not of your own making.

下一步:

1)升级到最新的3.1(或更好的3.1.1)Rails

1) Upgrade to latest 3.1 (or better 3.1.1) Rails

2)与gem的作者联系,以了解其3.1支持计划.他们可能已经在研究一种可以帮助您测试的解决方案.

2) Contact the authors of the gem to see what their 3.1 support plans are. They may already be working on a solution that you can help test.

3)如果您有技能,那么解决问题将为您贡献力量.

3) If you have the skills, it would be awesome for you to contribute back by solving the problem.

我建议您从Fiddler或Mac工具之类的以太窥视工具开始,以查看您的计算机在运行3.1.1与2.3时是否发出相同的请求/获得相同的响应.

I suggest that you start with an Ether peek tool such as Fiddler or a Mac tool to see if your machine is sending out the same requests/getting the same responses when running 3.1.1 vs 2.3.

然后调试....

这篇关于Rails 3.0.9 + open_id_authentication的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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