Rails 3.0.9 + open_id_authentication

不羁岁月 提交于 2019-12-24 21:25:13

问题


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|

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

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

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

Thanks.

Solution.

In sessions controller add

class SessionsController < ApplicationController
  include OpenIdAuthentication

In config/application.rb add

config.app_middleware.use OpenIdAuthentication

After this two steps all works fine.


回答1:


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

Next steps:

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

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) If you have the skills, it would be awesome for you to contribute back by solving the problem.

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.

Then debug....



来源:https://stackoverflow.com/questions/7446143/rails-3-0-9-open-id-authentication

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