3

I am having an issue with Omniauth.

Here is what I want to do(at least what I understood devise_token_auth documentation):

  1. Log in/signing up from client side using Facebook Login
  2. After a succesful log in, my facebook app has to run the callback url(provided by onminauth: www.abcdefg.com/auth/facebook/callback)
  3. The callback creates a user account in my database

The problem I am encountering is that, after a successful login, my Facebook app doesn't run the callback.

Here is a screenshot of my fb app config: screen shot 2016-04-18 at 12 45 40

On my Ruby-On-Rails side:

On my gemfile:

gem 'devise_token_auth' gem 'omniauth-facebook'

in config/initizializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, ENV['FACEBOOK_ID'], ENV['FACEBOOK_SECRET'], :scope => 'email,user_birthday' end

Here is my callback route(from rake routes): /auth/:provider/callback -- I've replaced :provider by facebook

If you think it is not the right way to implement a facebook login, please feel free to correct me.

Omar Lahlou
  • 1,000
  • 9
  • 33
  • 1
    This is not actually a “callback” – Facebook just redirects the user back to the address in their own browser, after they confirmed the login dialog. What URL gets redirected to, depends on the value of the `redirect_uri` parameter in the login dialog call – so go check that. – CBroe Apr 18 '16 at 15:22

1 Answers1

0

If you are using Devise gem for authentication, refer below link for complete details: https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview

And otherwise you can refer to below answer: https://medium.com/@euniceschoi/facebook-oauth-with-rails-33fc8c1a4e58

Priyesh Doshi
  • 320
  • 3
  • 13