Closed douglasrw closed 14 years ago
Have you installed the Devise initializer? If you haven't, Warden won't be available since Devise is what causes it to be loaded.
It's important to use the insert_before line rather than config.middleware.use, because otherwise, the OpenID integration may or may not work correctly (depending on which order Rails decides to load the Rack middleware on startup).
Yes, I installed the Devise initializer. Any other ideas?
Which versions of Rails and Devise are you using?
rails 2.3.8 and devise 1.0.8
OK, after messing with a Rails 2.3 version a bit, I got the following code to work. This is inside environment.rb, in the Initializer block:
require 'warden/manager'
config.middleware.use "Warden::Manager"
config.middleware.insert_before "Warden::Manager", "Rack::OpenID"
Could you try this out and let me know if it works for you?
That works. Thanks for your help!
No problem. I'll update the README and the example app.
I spoke too soon.
Adding those lines to the config breaks authentication: When trying to sign_in It always comes back saying 'invalid email or password' . I have database_authenticatable module loaded; and email, password, and identity_url on my form. using the config line from my first post everything works fine, or if I leave out the lines that you added I can at least authenticate to db.
OK, after some further investigation I think this is not a Rails 2 vs. Rails 3 issue, but rather a Devise 1.0 vs 1.1 issue. Devise 1.0 runs its middleware inclusion commands in an after_initialize block, but Devise 1.1 runs them on engine load.
The upshot of this, I think, is that the insert_before line is necessary for Devise 1.1 and up, and the use line is necessary for Devise 1.0. Since you say authentication works fine with the use line, I'll change the README to recommend this.
Thanks, and sorry for the hassle!
thanks for you work on this!
I followed your instructions, but the line config.middleware.insert_before(Warden::Manager, Rack::OpenID) Threw an uninitialized constant error for Warden.
This line: config.middleware.use "Rack::OpenID" from your devise_openid_example does work!