Facebook OAuth with Devise in Ruby on Rails

Colby CheeZe

After spending 30+ hours trying to get a solution to this and searching all corners of the earth, I am posting my first question here ever.

No matter what I try, I get

'The parameter app_id is required'

I've followed the docs to a T from https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

Here are the pieces I thought were most important...any ideas what I could be missing?

config/initializers/devise.rb

config.omniauth :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"], scope: 'user'

I've checked that the env params are correct on my system.

user.rb

    class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: [:facebook]

  def self.new_with_session(params, session)
    super.tap do |user|
      if data = session["devise.facebook_data"] && session["devise.facebook_data"]["extra"]["raw_info"]
        user.email = data["email"] if user.email.blank?
      end
    end
  end

  def self.from_omniauth(auth)
    where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
      user.email = auth.info.email
      user.password = Devise.friendly_token[0,20]
      # user.name = auth.info.name   # assuming the user model has a name
      # user.image = auth.info.image # assuming the user model has an image
    end
  end
end
Ahmad Al-kheat

Try this instead :

config.omniauth :facebook, "xxxxx", "xxxx"

Using the actual values inside config/initializers/devise.rb worked for me.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Ruby on Rails: Getting a route with Devise

From Dev

Ruby on Rails devise password override

From Dev

How to turn a Rails app with Devise into an OAuth provider?

From Dev

Devise Omniauth-facebook bypass rails validations

From Dev

how to implement google + , facebook login in rails with devise

From Dev

Facebook Profile Image & Data using Devise in Rails

From Dev

Rails Devise Twitter OAuth redirect to form to continue oAuth registration

From Dev

Ruby on Rails Devise Confirmation Token is nil

From Java

Register with a username using Ruby on Rails Devise Gem

From Dev

Ruby on Rails 4 authentication, devise vs bcrypt

From Dev

Ruby on Rails Devise Edit Registration Routing Error

From Dev

Ruby on Rails 4, Devise, and profile pages

From Dev

Ruby on Rails Devise - Cannot Log Out

From Dev

Create session with Devise in web API on ruby on rails

From Dev

Edit other user as admin in devise, ruby on rails

From Dev

Using ldap to connect to ad with devise ruby on rails

From Dev

Ruby on Rails Devise Error: no secure_key

From Dev

Ruby on Rails devise return role of user

From Dev

Ruby on Rails Devise - Cannot Log Out

From Dev

Using ldap to connect to ad with devise ruby on rails

From Dev

Equivalent of Devise (Ruby on Rails) in Spring MVC?

From Dev

Ruby On Rails Devise gem conflict error

From Dev

Good OAuth gems for Ruby on Rails

From Dev

Not found. Authentication passthru. (devise oauth facebook)

From Dev

Facebook and Devise

From Dev

Getting email back from Twitter Oauth with Devise and Rails

From Dev

Omniauth and google oauth2 error without Devise - Rails 4

From Dev

Rails devise omniauth-facebook .persisted? returning false

From Dev

Create User Account Settings Page in Ruby on Rails with devise

Related Related

  1. 1

    Ruby on Rails: Getting a route with Devise

  2. 2

    Ruby on Rails devise password override

  3. 3

    How to turn a Rails app with Devise into an OAuth provider?

  4. 4

    Devise Omniauth-facebook bypass rails validations

  5. 5

    how to implement google + , facebook login in rails with devise

  6. 6

    Facebook Profile Image & Data using Devise in Rails

  7. 7

    Rails Devise Twitter OAuth redirect to form to continue oAuth registration

  8. 8

    Ruby on Rails Devise Confirmation Token is nil

  9. 9

    Register with a username using Ruby on Rails Devise Gem

  10. 10

    Ruby on Rails 4 authentication, devise vs bcrypt

  11. 11

    Ruby on Rails Devise Edit Registration Routing Error

  12. 12

    Ruby on Rails 4, Devise, and profile pages

  13. 13

    Ruby on Rails Devise - Cannot Log Out

  14. 14

    Create session with Devise in web API on ruby on rails

  15. 15

    Edit other user as admin in devise, ruby on rails

  16. 16

    Using ldap to connect to ad with devise ruby on rails

  17. 17

    Ruby on Rails Devise Error: no secure_key

  18. 18

    Ruby on Rails devise return role of user

  19. 19

    Ruby on Rails Devise - Cannot Log Out

  20. 20

    Using ldap to connect to ad with devise ruby on rails

  21. 21

    Equivalent of Devise (Ruby on Rails) in Spring MVC?

  22. 22

    Ruby On Rails Devise gem conflict error

  23. 23

    Good OAuth gems for Ruby on Rails

  24. 24

    Not found. Authentication passthru. (devise oauth facebook)

  25. 25

    Facebook and Devise

  26. 26

    Getting email back from Twitter Oauth with Devise and Rails

  27. 27

    Omniauth and google oauth2 error without Devise - Rails 4

  28. 28

    Rails devise omniauth-facebook .persisted? returning false

  29. 29

    Create User Account Settings Page in Ruby on Rails with devise

HotTag

Archive