Using the devise_token_auth gem, I am making a rails-based API in which I am trying to reset my password using email.
On opening the email with reset link, I get this Error:
uninitialized constant DeviseTokenAuth::Concerns::User::BCrypt
The code points to Api::V1::Overrides::PasswordsController#edit
tokens[client_id] = {
token: BCrypt::Password.create(token),
expiry: expiry
}.merge!(token_extras)
What can I do to make my reset link to go onto my reset form?
I am following this for PasswordsController action
Tried checking github but there no one actually has faced this sort of error and I cannot rectify it.
P.S. I am not an experienced Ruby developer.
Probably just missing the bcrypt gem, e.g. add this in your Gemfile:
gem 'bcryt`
Related
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
I'm pretty new to rails and I'm beginning with rails-api.
Right now i'm trying to add authentication through doorkeeper using resource owner password credentials.
But when im going to the /oauth/applications page to set a new app to add my frontend for exemple, i get an error about an authenticity token:
ActionController::InvalidAuthenticityToken in Doorkeeper::ApplicationsController#create
As it's a page implemented in the doorkeeper gem itself, isn't it suppose to work by itself?
Does any one know what's going on and how to solve it?
Thank you guys
This is due to the forgery protection enabled by default by rails.
If you're working on an API only, my guess is that you can simply turned it off in the environment file (test/developpement/production.rb) by adding this line :
config.action_controller.allow_forgery_protection = false
Cheers.
It's an incompatibility with rails-api and doorkeeper.
My project are being started and based on this and other things, I've chose grape instead of rails-api. It works for me!
If you can do this, I can't help you now!
tip: Enjoy with grape!
I have a rails app using omniauth for user authentication with facebook. twitter and google. I've add one more provider StockTwits, with gem omniauth-stocktwits. And now my application cant' start because of error:
/home/vladimir/.rvm/gems/ruby-1.8.7-p371#ea/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing': uninitialized constant OmniAuth::Strategies::Stocktwits (NameError)
I cant understand what problem is... Why aws s3 raises error for omniauth? And What can I do to fix it?
The constant should be StockTwits, not Stocktwits. Are you calling it without the capital T anywhere?
Otherwise could you give me more information on how you're requiring and initializing omniauth-stocktwits, and what the rest of the stack trace from your error looks like, so I can try reproducing it?
Also Google is showing a lot of unrelated const_missing errors bubbling up through the AWS-S3 gem, so it's possible this is completely unrelated to AWS.
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!
So I followed the railscast tutorial (http://railscasts.com/episodes/170-openid-with-authlogic) and used the old version of the plugin from Ryan's git file. I can now successfuly create/register a user using OpenID (Google), but I cannot log in with this user. When I submit the OpenID that has been registered, I get "uninitialized constant Rack::OpenID". Any ideas?
Thanks!
I would suggest trying the latest version of the plugin, or the gem.
Things change quick in rails, and old code can break with new versions of rails.
I would suggest trying Devise, it is easier for integrate OpenId, Facebook, Tweeter ...
https://github.com/plataformatec/devise