ruby '2.6.3' gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
I'm using the latest omniauth-facebook and devise together Gemfile: gem 'devise' gem 'omniauth-facebook'
Getting this error when starting the server:
/versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise-4.7.3/lib/devise/omniauth.rb:12:in `': You are using an old OmniAuth version, please ensure you have 1.0.0.pr2 version or later installed. (RuntimeError)
The problem is that if I try to use older omniauth-facebook versions the server works but then the Facebook authentication stops working properly (e.g. fails including emails despite
scope: 'email', info_fields: 'email,name'
in devise.rb. )
I have tried many different version combinations of omniauth-facebook and devise. Either Facebook-authentication stops working properly or the server fails (see above).
Devise is a ruby on rails gem which handles all user authentication features in your rails application in a very flexible manner. Omniauth on Facebook enables users to login/signup using their facebook credentials (using their existing account). Devise and omniauth can be used to authenticate users in the same way as a third-party service. Dr.
You can register as a new user by visiting http//:localhost:3000/users/sign_up. Go ahead and create one! Add a new column called uid to the model that Devise generated. Go into config/initializers/devise.rb and under the omniAuth section add: This requires that you have FACEBOOK_KEY and FACEBOOK_SECRET in your environment.
Devise is a ruby on rails gem which handles all user authentication features in your rails application in a very flexible manner. Omniauth-facebook on the other hand enables user authentication (login/signup) using their existing facebook account.
Omniauth allows you to easily integrate more than sixty authentication providers, including Facebook, Google, Twitter and GitHub. In this tutorial, I’m going to explain how to integrate these authentication providers into your app. For the purpose of this tutorial, we are going to call our new app omniapp.
Please downgrade OmniAuth:
gem "omniauth", "~> 1.9.1"
That's worked for me.
Devise 4.8.0 (shipped yesterday) resolves this.
Using
gem 'devise', github: 'heartcombo/devise', branch: 'ca-omniauth-2'
In Gemfile will fix the problem, awaiting a merge.
Updated my answer based on Carlos answer below, I was in a rush when I posted this using ref.
Thank You, Carlos for maintaining Devise.
This is Carlos, Devise maintainer. Please keep an eye on that Pull Request linked above, I just shared how you can test it in your app there:
I'd recommend using the branch ref instead of the git ref directly:
gem 'devise', github: 'heartcombo/devise', branch: 'ca-omniauth-2'
With that you should be able to run bundle update devise omniauth
which should hopefully give you OmniAuth 2 and this Devise branch. That should allow the app to boot up.
Lastly, if you've copied over the Devise shared links on your app, or if you have your own links to initiate the OmniAuth authentication flow, you need to make sure they're changed to use a form. (you can do that by using link_to with method: :post
option for example, or using button_to
, if that works for your app.) Please note that this is a requirement change in how OmniAuth work due to a security issue, read more.
If you run into any issues please comment back in GitHub, and we'll work to get them resolved soon so we can release a new Devise version that fully supports OmniAuth 2. Thanks.
I'm pretty sure the issue is related to this devise PR, https://github.com/heartcombo/devise/pull/5327
Devise currently has a version check that doesn't include OmaniAuth > 1.x.x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With