Note that there are some explanatory texts on larger screens.

plurals
  1. PORails: Could not authenticate you from Facebook because "Invalid credentials"
    primarykey
    data
    text
    <p>I integrated omniauth-facebook using <a href="https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview" rel="nofollow">https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview</a>. But I am getting error of :</p> <pre><code>Could not authenticate you from Facebook because "Invalid credentials". </code></pre> <p>I have devise installed. When i click on facebook sign in link, it redirects me to facebook login. When i enter my details, it comes back to devise sign and gives above error. I checked the solution for "Invalid credentials" on <a href="https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview" rel="nofollow">https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview</a> and my app is header set for App Type = Web. Not getting why it is not working.</p> <p>Also my app is live but yet to approve from facebook. But i don't think it is related to this error. Following are the things i did for omniauth-facebook:</p> <p>Gemfile contains:</p> <pre><code>gem 'omniauth' gem 'omniauth-facebook', '1.4.0' </code></pre> <p>In user model, added:</p> <pre><code>devise :omniauthable, :omniauth_providers =&gt; [:facebook] attr_accessible :provider, :uid def self.find_for_facebook_oauth(auth, signed_in_resource=nil) user = User.where(:provider =&gt; auth.provider, :uid =&gt; auth.uid).first unless user user = User.create(name:auth.extra.raw_info.name, provider:auth.provider, uid:auth.uid, email:auth.info.email, password:Devise.friendly_token[0,20] ) end user end </code></pre> <p>devise.rb</p> <pre><code>require "omniauth-facebook" config.omniauth :facebook, "APP_ID", "APP_SECRET", :scope =&gt; "offline_access, email" </code></pre> <p>Link for facebook sign_in:</p> <pre><code>&lt;%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) %&gt; </code></pre> <p>route.rb:</p> <p>devise_for :user, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }</p> <p>Omniauth controller:</p> <pre><code>class Users::OmniauthCallbacksController &lt; Devise::OmniauthCallbacksController def facebook @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user) if @user.persisted? sign_in_and_redirect @user, :event =&gt; :authentication #this will throw if @user is not activated set_flash_message(:notice, :success, :kind =&gt; "Facebook") if is_navigational_format? else session["devise.facebook_data"] = request.env["omniauth.auth"] redirect_to new_user_registration_url end end end </code></pre> <p>Can anybody help in this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload