10

Im following Ryan Bates Screen Cast #360 Facebook Authentication...

When i get to to part where i click the link to log into facebook i get a

{
   "error": {
      "message": "Missing client_id parameter.",
      "type": "OAuthException",
      "code": 101
   }
}

i tried restarting the server like previously stated Im pulling my hair out trying to figure this out

My site url at facebook development page is correct i've followed his steps hundreds of times

Pritesh Jain
  • 9,106
  • 4
  • 37
  • 51
user1502223
  • 645
  • 2
  • 10
  • 27

1 Answers1

16

May be you have not setup the env for FACEBOOK_KEY and FACEBOOK_SECRET

In terminal (if you are using linux or mac)

$ export FACEBOOK_KEY=zzyzyzyzyzyzzy
$ export FACEBOOK_SECRET=zzyzyzyzyzyzzysbdbdsndnds

#now start rails from same terminal
$ rails s

this will now pass the values of FACEBOOK_KEY and FACEBOOK_SECRET to application.

Or second option

provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']

to this

provider :facebook, 'FACEBOOK_KEY', 'FACEBOOK_SECRET'

Diff between using two approaches.

The drawback of second type is, you need to keep the keys into the code repository. which is not a safe approach.

Pritesh Jain
  • 9,106
  • 4
  • 37
  • 51
  • Hay @Pritesghj for a quick response. Here is my error... Started GET "/users/auth/facebook" for 127.0.0.1 at 2012-11-12 00:00:52 +0500 (facebook) Callback phase initiated. (facebook) Callback phase initiated. (facebook) Authentication failure! invalid_credentials: OAuth2::Error, : {"error":{"message":"Error validating client secret.","type":"OAuthException","code":1}} Processing by Users::OmniauthCallbacksController#failure as HTML – Nadeem Yasin Nov 11 '12 at 19:03
  • and here is my ominath.rb file.. Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, "145849772898524xxxx", "741238950bbac0f5b458aeeb00236ece" end – Nadeem Yasin Nov 11 '12 at 19:05
  • @PriteshJ - Ran into same problem going through RailsCast. Both of your solutions worked perfect, thanks! – Brett Sanders Dec 20 '12 at 22:51
  • @PriteshJ can you answer this similar question http://stackoverflow.com/questions/30250939/the-parameter-app-id-is-required-on-heroku-omiauth-facebook-integration – codigomonstruo May 15 '15 at 03:47