Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config Facebook Login App for oAuth #3

Open
byhbt opened this issue Jun 6, 2020 · 0 comments
Open

Config Facebook Login App for oAuth #3

byhbt opened this issue Jun 6, 2020 · 0 comments
Labels
Ruby Learning Ruby on Rails
Projects

Comments

@byhbt
Copy link
Owner

byhbt commented Jun 6, 2020

Problem:

As an user i want to login via my Facebook account.
And the website app can retrieve my Facebook info (email, public info) to create new account in system.

Solution:

facebook-login-app-configuration

Lesson:

  1. Use Ngrok to enable public access to local development webserver.
  2. Provide the term and privacy page to Facebook App configuration to make it live.
  3. Check correct callback URL, it often includes the https
  4. Allow Rails app access from Ngrok, by adding the below code to file:
config/environments/development.rb
config.hosts << "a2395ad5fbe8.ngrok.io"
  1. Config Devise
config/initializers/devise.rb
config.omniauth :facebook, APP_CONFIG.facebook.app_id, APP_CONFIG.facebook.secret, scope: APP_CONFIG.facebook.scope

File: config/settings/application.rb

  group :facebook do
    set :namespace, 'FACEBOOK_NAMESPACE'
    set :app_id, 'FACEBOOK_APP_ID'
    set :secret, 'FACEBOOK_SECRET'
    set :scope, 'email, public_profile, user_birthday, user_likes'
    set :cache_expiry_time, 7.days
  end
@byhbt byhbt added the Ruby Learning Ruby on Rails label Jun 6, 2020
@byhbt byhbt changed the title Config facebook app for oAuth Config Facebook Login App for oAuth Jun 11, 2020
@byhbt byhbt added this to the First 50 issues milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ruby Learning Ruby on Rails
Projects
Learning
  
Awaiting triage
Development

No branches or pull requests

1 participant