开发者

NoMethodError when attempting to use open_id_authentication

I'm currently adding OpenID login support for a Rails 3.0.0 application.

I have already installed ruby-openid (the gem) and open_id_authentication (the plugin). However, after following the steps required to set up both (from the READMEs), I am still getting this error:

undefined method `authenticate_with_open_id'

I tried Googling the problem, but most threads seem to date from years ago and remain suspiciously unanswered.

Am I missing something obvious? What is causing this problem? Note that I have had no problems switching to file-based stores in environment.rb, so I am sure that the plugin is correctly installed.

Update: Some unresolved problems of the same nature:

htt开发者_StackOverflow中文版p://railsforum.com/viewtopic.php?id=23151


Experiencing a similar error; oddly, I have this working on Rails 3.2 on another branch, and can't figure out the difference; anyhow I found that I got a little further by following suggestions here: Rails 3.0.9 + open_id_authentication

That is, adding the line include OpenIdAuthentication after class SessionsController < ApplicationController:

class SessionsController < ApplicationController
  include OpenIdAuthentication

But now I get a Completed 401 Unauthorized in my log, and see a blank page -- just and tags. Ugh.

Update: Ooh, got further; I followed this post: open_id_authentication - "OpenIdAuthentication.store is nil. Using in-memory store." problem

and as they suggested, "added an initializer named config/initializers/openid.rb with this inside":

require 'open_id_authentication' # this was needed, but not described in the referred-to post
OpenIdAuthentication.store = :file

I was then directed to the OpenId provider and was able to click "allow", but on returning to my app, I now see:

NoMethodError in SessionsController#create
undefined method `encoding' for nil:NilClass

Anyhow, finally, I found a restful routes problem and fixed that, and now logging in works!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜