Commit 3723122c by Mykhailo Makohin

finish facebook registration

parent b972dd4e
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
@user = User.from_omniauth(request.env["omniauth.auth"])
......
......@@ -2,9 +2,10 @@ class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
:recoverable, :rememberable
devise :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"]
......
# Add configuration values here, as shown below.
#
# pusher_app_id: "2954"
# pusher_key: 7381a978f7dd7f9a1117
# pusher_secret: abdc3b896a0ffb85d373
# stripe_api_key: sk_test_2J0l093xOyW72XUYJHE4Dv2r
# stripe_publishable_key: pk_test_ro9jV5SNwGb1yYlQfzG17LHK
#
# production:
# stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H
# stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU
development:
FACEBOOK_APP_ID: "678588699322994"
FACEBOOK_APP_SECRET: "fb6f9a67539d5b2bbdc2e2e47c7d64f2"
\ No newline at end of file
......@@ -296,5 +296,7 @@ Devise.setup do |config|
# When set to false, does not sign a user in automatically after their password is
# changed. Defaults to true, so a user is signed in automatically after changing a password.
# config.sign_in_after_change_password = true
config.omniauth :facebook, "495362301276927", "1e25c95ba8cc4f4fc91ca12d213e32bb", callback_url: "http://localhost:3000/users/auth/facebook/callback"
config.omniauth :facebook, "2429624190692901", "03da24c1517b0bfa4acc70852f61fb60", token_params: { parse: :json }
callback_url: "http://localhost:3000/users/auth/facebook/callback"
# config.omniauth :facebook, "APP_ID", "APP_SECRET", token_params: { parse: :json }
end
Rails.application.routes.draw do
resources :templates
devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment