Bonjour,
Je n’arrive pas du tout à faire fonctionner la connexion via Facebook sur mon application Ruby on Rails avec Devise. J’ai pourtant l’impression d’avoir correctement suivis plusieurs tutoriels…
Je donne mon pseudo Skype si quelqu’un souhaite m’aider via Skype : cbourreedu69
Sinon voici la seul erreur que j’obtiens :
Voici ce que j’ai fait :
1 - J’ai donc depuis mon compte Facebook développer :
Navigate to developers.facebook.com.
Click “Add new app” under “My Apps” menu item.
Click “Website” in the dialog.
Click “Skip and Create ID”.
Enter a name for your app and choose a category, click “Create”.
You will be redirected to the app’s page. Click “Show” next to the “App Secret” and enter your password to reveal the key. Copy and paste those keys into your initializer file.
Don’t leave this page yet. You have to do some set up to make the app active:
Open “Settings” section.
Click “Add Platform” and choose “Website”.
Fill in “Site URL” (“http://localhost:3000” for local machine) and “App Domains” (must be derived from the Site URL or Mobile Site URL).
Fill in “Contact E-mail” (it is required to make app active) and click “Save Changes”
Navigate to the “Status & Review” section and set the “Do you want to make this app and all its live features available to the general public?” switch to “Yes”.~
2 - Exécuter cette migration :
1 2 3 4 5 6 7 8 9 10 11 | class UpdateDeviseForFb < ActiveRecord::Migration def change add_column :users, :provider, :string add_column :users, :uid, :string add_index :users, :provider add_index :users, :uid add_index :users, [:provider, :uid], unique: true end end |
3 - Ajouter à mon fichier routes.rb
1 2 3 | devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' } |
4 - Sur mon controllers/user.rb
1 2 3 4 5 | devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable, :timeoutable, :omniauthable, omniauth_providers: [:facebook] ` |
5 - J’ai créé controlles/users/omniauth_callbacks_controller.rb :
1 2 3 4 5 6 7 8 | class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController skip_before_filter :redirection_lancement skip_before_filter :verify_authenticity_token def facebook render :inline "ok" end end |
6 - Mise à jour du fichier initializers/devise/rb
1 | config.omniauth :facebook, '412442349086805', 'key', scope: 'user,public_repo' |
Merci d’avance