I have a web application running Devise and Omniauth to authenticate a user on Facebook. When I click on a link to log in though Facebook, it routes me to
/users/auth/facebook/callback?state=[state]code=[code]
Which is correct. But the page gives me the following error.
uninitialized constant ApplicationController::DeviseController
The line that it points to is in the ApplicationController
DeviseController.respond_to :html, :json
I've included my relevant code here https://gist.github.com/testrecord/5050992 In addition, I do have it set up in the initializer.
Has anyone seen an error like this? Any help is appreciated.
Related
Rails 4.2, Ruby 2.2.0, Devise 3.5.7
I have an Admin model. In ideal case after sign in, it should be redirected to homepage. But in my case, it is signing in successfully, but while redirecting, somehow authentication fails, causing it to redirect to the sign in page again.
The controller which gets called is:
Class Admin::DashboardsController < ApplicationController
before_action :authenticate_admin!
before_filter :authorize
def show
end
end
In first view, I thought it is a problem with authorize method. But code never reaches it.
authenticate_admin! is a devise method. And I don't know if there is a point in debugging.
Surprisingly it works on local, but results in 401 Unauthorized after deploying.
Logs
I think the application is fine. It has to do something with your server configurations. Something might be missing.
As you said it is working locally, there might be something that you changed in your configurations for the server, that might be causing the problem. Check your config files, application.rb or any other subdomain files that you might be using.
I have been trying to sign in after signing out on my application using devise but I am having an issue with the cookies I think because I have to refresh my web page in order to sign in again. I tried using activerecord-session_store gem and I follow the steps to configure it. I mean, I installed the gem, I generated the recommended migration on the gem documentation and generated the table using rake db:migrate command, I also changes the session_store.rb file but I feel that I am missing something to make it work since I tried it and the same happens. Please help me if you feel I am missing something or if you have other solution for this problem. Many thanks in advance
You are probably getting a "Can't verify CSRF token authenticity" error. Can you check your server logs?
In your ApplicationController please add the following and check if you get an error.
protect_from_forgery with: :exception
With my default devise configuration, when sign up fails due to some reason (e.g. email already taken), it redirects to /users instead of the same path /users/sign_up. Any leads into how I can debug this?
I tried to override after_sign_up_fails_path_for(resource) in my application controller, but it is not getting called.
My application is using devise 3.2.4 on rails 3.2.13
Ruby 1.8, Rails 2.3.15, devise 1.0.10 and warden 0.10.3
I have implemented admin using this example: https://github.com/plataformatec/devise/tree/v1.0. When I sign out it show the message but I can still acess those page without signing in again. Can anyone let me know what is wrong with it.
Thanks in advance.
SInce you have not added any code, I can just guess that you have missed out the before filter:
before_filter :authenticate_user!
use this in the controller abouve all methods, this method is available by devise.
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:
http://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!