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

Facebook login - "The parameter app_id is required" #155

Closed
raulpopadineti opened this issue Apr 10, 2015 · 7 comments
Closed

Facebook login - "The parameter app_id is required" #155

raulpopadineti opened this issue Apr 10, 2015 · 7 comments

Comments

@raulpopadineti
Copy link

I get "The parameter app_id is required" when I'm trying to login through facebook.

I added to my Gemfile gem 'spree_social', github: 'spree-contrib/spree_social', branch: '3-0-stable' and added the facebook authentication method in the admin section.

I figured out that if I add the APP ID manually to the url it redirects me to facebook, but when the callback url is called, I get another {"error":{"message":"Missing client_id parameter.","type":"OAuthException","code":101}}.

I'm pretty sure the problem is somewhere from the Spree::OmniauthCallbacksController, because it doesn't pass the client_id param correctly. I'll dig deeper into the code to see if I can find the problem and after that I'll fill in a PR, but if you guys know the solution, please let me know.

Here is my full Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.1'

gem 'mysql2', '0.3.18'

gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'jquery-rails'
gem 'turbolinks'

gem 'jbuilder', '~> 2.0'

gem 'sdoc', '~> 0.4.0', group: :doc

# Spree core
gem 'spree', git: 'https://github.com/spree/spree.git', branch: '3-0-stable'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'

# Spree extensions
gem 'spree_i18n', git: 'git://github.com/spree/spree_i18n.git', branch: '3-0-stable'
gem 'spree_multi_currency', github: 'spree-contrib/spree_multi_currency', branch: '3-0-stable'
gem 'spree_reviews', github: 'spree-contrib/spree_reviews', branch: '3-0-stable'
gem 'spree_editor', github: 'spree-contrib/spree_editor', branch: '3-0-stable'
gem 'spree_social', github: 'spree-contrib/spree_social', branch: '3-0-stable'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development do
  gem 'bullet'
  gem 'better_errors'
  gem 'meta_request'
  gem 'annotate', '>= 2.5.0'
  gem 'rails-footnotes', '>= 3.7.9'
end

group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
  gem 'thin'
  gem 'quiet_assets'
end
@raulpopadineti
Copy link
Author

As a comment to this, it looks like if I'm using the second option (to provide a social authentication provider through an initializer) it works.

# Ensure our environment is bootstrapped with a facebook connect app
if ActiveRecord::Base.connection.table_exists? 'spree_authentication_methods'
  Spree::AuthenticationMethod.where(environment: ::Rails.env, provider: 'facebook').first_or_create do |auth_method|
    auth_method.api_key = ENV['FACEBOOK_APP_ID']
    auth_method.api_secret = ENV['FACEBOOK_APP_SECRET']
    auth_method.active = true
  end
end

Maybe the FB app ID an secret key aren't treated correctly if they're added from the admin section?

@amOK13
Copy link

amOK13 commented Apr 28, 2015

where did you add this in an initializer spree_social.rb for example?

@raulpopadineti
Copy link
Author

@amoksunrise I added the code above in the config/initializers/spree_social.rb, actually that is the whole content of the file.

@amOK13
Copy link

amOK13 commented Apr 28, 2015

thanks

@uginm102
Copy link

Just run into the same issue, using spree 3.1 and spree social 3.1. Using the admin section seems not to work while using the code in initialise works. I think that the admin section has a bug and therefore this issue shouldn't be marked as closed or at least we have another issue opened for this.

@raulpopadineti
Copy link
Author

+1 to what @uginm102 said.

@raulpopadineti
Copy link
Author

@damianlegawiec please see @uginm102's comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants