Thuzi / facebook-node-sdk

Modeled from the (Facebook Javascript SDK), now with the facebook-node-sdk you can now easily write the same code and share between your server (nodejs) and the client (Facebook Javascript SDK).
Other
738 stars 250 forks source link

scrumptious sample not working #41

Closed JiboStore closed 11 years ago

JiboStore commented 11 years ago

Step to reproduce:

  1. Login to Facebook and grant all requested permissions
  2. select all the food, place, and friends
  3. press Announce
  4. allow all the requested post dialog by Facebook
  5. expected an open graph action to be posted on my page

but instead, get OAuthException: An unknown error has occured the error: https://gist.github.com/JiboStore/5693636/61d411d860ad1c6c003e772cf2d8004ed4b08347 or pasted as is:

access_token = CAAB2dKc4ZCMEBAAn2vCajKjEJUK5DGQ2urcUIij2wtLbvg6fmbUmEQW4YKxj5QZAemDyx8yLXKyLlZBcZBAeUMIhFUzmul8G45k5h0hBZCu3R07tCZC4QZBQRElACOKYh48CDUodIA4P7t4HITHvwgZC { error: { message: 'An unknown error has occurred.', type: 'OAuthException', code: 1 } } JSON Stringify: {"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}} POST /announce 500 452ms - 486 { meal: 'http://nodescrumptious.azurewebsites.net/meals/cheeseburger', place: '361771023937832', tags: '510683132', access_token: 'CAAB2dKc4ZCMEBAIoHzPLVSv8DWuXY8UZCMzZABtjA0wCMfwBEK7lVuy3ZBhXON3Tv7cY75VBI4BScOl3HSt285h5g01xxDJ9x5T5nZBzDIBgZBiE0twB9RcYDcUetNYsGGxo627upZA7clCZBNsYknAFvysNyLSDJbcZD' } { error: { message: 'An unknown error has occurred.', type: 'OAuthException', code: 1 } } GET /login/callback?code=AQCMoSVxtJTPFjQDluAootk4oztVvCLTuo8nmoeSUUlohyWg9_uht_aUVRbBQd-R9hsDL1wr4HQz_L4rC_k1rorJwhZIOeZI5yRQ1trSLgmNJqpaCJ4s5dFp0hyzAZ9CbPNwNf60N1JORQP7u2LIvnjfNoytzud4KgU1SnmvHmzSFiOLl3gNS5MViwOPOyf-oJWgiVMObfxAEybTk77aziDTRUwbq_ElKZcp5Efi5bCweg36Zm-LEoeWnU9vWDnpk9wuadQaPkF9EA_vgFPHYpVYjZTaS5M3JjeIwR6scnx8b2OeKAWDu9GT-ZISxLQXZdI&state=%7B%22meal%22%3A%22http%3A%2F%2Fnodescrumptious.azurewebsites.net%2Fmeals%2Fcheeseburger%22%2C%22place%22%3A%22361771023937832%22%2C%22tags%22%3A%22510683132%22%7D 500 1362ms - 113

prabirshrestha commented 11 years ago

Did you configure the open graph for your app id?

You can follow the instructions at http://facebooksdk.net/docs/windows/tutorial/ under Publish Open Graph Story.

JiboStore commented 11 years ago

I am using the appId provided with the sample, which I assume must have all the open graph objects configured properly, but when I change the appId to my appId and created the objects, actions and urls according to the sample, I get the same error.

prabirshrestha commented 11 years ago

The app used is currently sandboxed. You will need to create your own app and configure for now.

JiboStore commented 11 years ago

I see... the app I created is also sandboxed, maybe this is why... I'll try un-sandbox and update the result. Thanks!

JiboStore commented 11 years ago

I un-unsandbox my app, created all the opengraph action and objects, and get a slightly different error:

{ error: { message: 'An unexpected error has occurred. Please retry your request later.', type: 'OAuthException', code: 2 } }

but I received the callback correctly: GET /login/callback?code=AQDhd51jWWiIet18IuigJJj2nnq_6MGWrM44eEIpfng9iWjjYveaVqGcqQeULEXFexpgD-VqQyydPTr4lKcdMwmeDHneU0TLH0KZVjRCb1Wt6MS2ZuDdiEFo6mQvFZc8ikz08DCt-gyOL47mKIK6sGMjRIuM0-e75qgvvqTIOnYDBvl4qHkUqf9LxKhZaSjw38iHIhAwIsaEa7pCfYEfx4RHi-gVdqXUfDhzqnm6D3bYEtMbmJbmqCuWEEAieOEtZH0UU8c95yAZxA7fA4SL7Ctva5-nvqkjR9QRu-nhjBiNq-nMyDtAkzPQcu0_5m3vtX0&state=%7B%22meal%22%3A%22http%3A%2F%2Fnodescrumptious.azurewebsites.net%2Fmeals%2Fcheeseburger%22%2C%22place%22%3A%22235164596508519%22%2C%22tags%22%3A%22510683132%2C512181204%22%7D 500 1355ms - 149

Anyone ever encounter this before?

prabirshrestha commented 11 years ago

Seems like your open graph url is still pointing to our nodescrumptious.azurewebsites.net url (your app doesnt have access to that url). You will need to change those url to point to your url.

https://github.com/Thuzi/facebook-node-sdk/blob/master/samples/scrumptious/public/js/main.js#L13-L49

var meals = [
    {
        "id" : "cheeseburger",
        "title" : "Cheeseburger",
        "url" : "http://nodescrumptious.azurewebsites.net/meals/cheeseburger"
    },
        .....
];
JiboStore commented 11 years ago

yes, you are right! Thank you very much!