【发布时间】:2011-09-16 14:23:23
【问题描述】:
我正在使用 open_id_authentication gem 向 google 进行身份验证。在我的会话控制器中,我调用了
authenticate_with_open_id(complete_identity_url, OPENID_OPTS) do |openid_result, identity_url, registration|
它返回 401 状态代码未验证。但它应该显示我必须确认访问的谷歌页面。
我制作了示例应用程序:https://github.com/mbashirov/rails3-test,它只有会话控制器中的代码和路由集。
该代码在 rails 2.3 应用程序上完美运行。有错误吗?
谢谢。
解决方案。
在会话控制器中添加
class SessionsController < ApplicationController
include OpenIdAuthentication
在 config/application.rb 中添加
config.app_middleware.use OpenIdAuthentication
这两个步骤后一切正常。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 openid google-openid