Giter Site home page Giter Site logo

thuzi / facebook-node-sdk Goto Github PK

View Code? Open in Web Editor NEW
736.0 736.0 249.0 2.13 MB

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).

License: Other

JavaScript 100.00%

facebook-node-sdk's People

Contributors

cruppert avatar etticat avatar jimzim avatar jschluchter avatar louisameline avatar mostlygeek avatar oazais avatar prabirshrestha avatar sodoku avatar stowns avatar tk120404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facebook-node-sdk's Issues

Option to add channelUrl on facebook sdk initialisation

I wanted to set channelUrl on initialisation. I see there is no such feature in this package. I think this feature is essential to solve a issue while loading a facebook video.

A short note on the issue when embedding a facebook video in iframe tag. Firefox browser console is reporting an error :"Error: Permission denied to access property 'toString' ". There is no such issue in Chrome. I see this SO link http://stackoverflow.com/questions/15518450/how-to-fix-the-error-i-am-getting-while-loading-the-facebook-javascript-sdk . I wanted to try this 'channelUrl' fix.
Also, in this SO link http://stackoverflow.com/questions/13100611/replace-url-from-youtube-to-embed-code-error-permission-denied-to-access-prop it's reported as a browser specific issue, I think this can be fixed.

HTML:

<iframe width="720" height="1280" frameborder="0" src="https://www.facebook.com/video/embed?video_id=627802933963417">

Is this repository maintained?

I see bunch of pull requests waiting. Seems like we have to fork louisameline's fork and merge manually some of the pull requests

Used split() on a non-string

fb.js line 320:

Current: split = body[key].split('=');

Suggested change: split = body[key].toString().split('=');

It currently gives me this error:

/node_modules/fb/fb.js:321
                split = body[key].split('=');
                                  ^
TypeError: Object function () {
    var i = this.length, j, temp;
    if ( i == 0 ) return this;
    while ( --i ) {
        j = Math.floor( Math.random() * ( i + 1 ) );
        temp = this[i];
        this[i] = this[j];
        this[j] = temp;
    }
    return this;
} has no method 'split'

Casting the response to a string solves the issue.

Still having issues with appsecret_proof

I have this error , when I try to make a call to fb.
I haven't updated for while, but last this was wrking before 4 weeks. I saw the error and thought that if I install the latest version it will fix it, but it's not the case

Invalid appsecret_proof provided in the API argument

Explanation on "whitelisted" options

Hello and thank you for this library.

I do not understand the following paragraph of the documentation, especially the third sentence. What do you mean by whitelisted ? Thank you.

'scope' and 'redirectUri' have been whitelisted in options for convenience. These value will not be automatically added when using any of the sdk apis unlike the above options. These are whitelisted so you can use it to pass values using the same FB object.

Extend access_token

Hey,

I want to extend the validity of a long access_token using this method.

When I try, the expires doesn't look to get longer:

expires :  5176585  =  59.91417824074074 days
expires :  5176572  =  59.914027777777775 days
expires :  5176562  =  59.913912037037036 days

Is there something I'm wrong with?

Thanks a lot,
Philmod

500 FacebookApiException:

I run the example,

npm install
cd samples/scrumptious
npm install
node app.js

and I make click on the button login of facebook, an when retrieved from facebook, this is the error that showme.

500 FacebookApiException: {"error":{"message":"Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request","type":"OAuthException","code":100}}

This exactly happend with other libraries of facebook sdk, I don't know if is a bug of this library or if is some that I make wrong.

posting images to event/album using graph api

This library is very useful, and I'm using it to post events on facebook through the api. I'd like to POST an image with the event, but doing this seems tricky...

The following curl command works for posting an event with an image (assuming the token has all the required permissions):

curl -F 'access_token=<insertAccessToken>' \
-F 'name=Test Event 1' \
-F 'start_time=2013-01-20T12:00:00+0000' \
-F '@newImageName.png=@/Users/<mycomputer>/Sites/Node/facebook/image.png' \
http://graph.facebook.com/me/events

I found numerous people on stackoverflow.com looking for answers using the PHP facebook-sdk. Most seemed successful with both events and photos to albums:
http://stackoverflow.com/questions/2718610/upload-photo-to-album-with-facebooks-graph-api

The key is setting the image as a separate multipart request and passing that in the POST. I assume this is what the curl -F '@newImageName.png=@/path//to/image.png' does before POSTing the event. I want to achieve this multipart-formatting image post from my machine to FB using this library.

This seems like a good start to adding this feature:
mscheibe/python-sdk@13d5849

I looked into the request.js library and it seems to support multipart posts also, I just don't know exactly how to go about implementing this. I might just end up adding the Node-Curl wrapper from https://github.com/chriso/curlrequest, but that seems a bit overkill.

Any help would be great.

Publish new version to npm

The newest version of this appears to be 0.7.3, however only 0.7.0 has been published to npm.

So if you npm install fb you get an old version with no appsecret_proof support.

Posting as a site

Hey.

I am trying to figure out how I would post as a site. At the moment, I want to pick up a new blog post from a site in a worker process and if the blog post does not exist on my facebook page, it should post there.

As said, I am rather new to using the SDK, but would just like to post. Later, I may want to edit, if the post changed.

Kind regards, Ingwie.

the example "scrumptious" doesnt work

it's returning

{

"error": {
    "message": "(#100) problem with action type (360109757437618)",
    "type": "OAuthException",
    "code": 100
}

}
when trying to post...

no response when trying to post FB.api( 'me',...

Not sure if I just did it wrong - I've had other requests work fine 'me/friends' or 'me/albums' - but when I tried just requesting 'me' I never got a response. Can you please verify if this works for you?

Does uploading image is working ?

Does this call is working ?

     FB.api(pageid + '/photos', 'post', { message: body, source: buff, }, function (resf) {
                    if (!resf || resf.error) {
                        console.log(!resf ? 'error occurred' : resf.error);
                        return;
                    }
                    console.log( resf);
                    res.send(resf);
                });

Does the oauth with fileuplad is working ?

 FB.api('oauth/access_token', {
    client_id: clientid,
    client_secret: clientsecret,
    redirect_uri: redirecturi,
    code: code,
    scope: scope,
    fileUpload : true,
    }

Can't reset access token in-state

Running something where I need to change the access token on the fly, but they way the code is, once it's set, it never looks for it again to change.

Something like this should do the trick

if(options('accessToken') && params.access_token != options('accessToken')) {
...etc

allow to set user-agent

useful when using etags. also should be set by default. pass node version?

FB.options({'user-agent': 'thuzi_nodejssdk/0.0.7 (facebook-node-sdk)'});

facebook-node-sdk with browserify

Is this suppose to work out of the box?

I'd like to replace my fb sdk async call with this & browserify, but I get a node_modules error on the client side.

I'm just asking before digging further.

the demo /announce, run error OAuthException

FB.getLoginUrl({ scope: 'user_about_me,publish_actions', state: encodeURIComponent(JSON.stringify(parameters)) });

but,If I use other user(not application owner),It's has an error:

{ error:
{ message: '(#200) Requires extended permission: publish_actions',
type: 'OAuthException',
code: 200 } }

v2.0 is not working with your api.

Hello, i tried your api from npm, and i found that your api is not working with v2.0. did you added some extension on it? or i have to manually edit your library by appending "v2.0" in all endpoints?

Please reply.

Express 500 FacebookApiException

I'm receiving the message below after I have log to facebook.

Express
500 FacebookApiException: {"error":{"code":"EHOSTUNREACH","errno":"EHOSTUNREACH","syscall":"connect"}}

Get all the albums from facebook using nodejs and express

I need to get all the albums from facebook using nodejs and express.I am using passport to authenticate the user.

passport.use(new FacebookStrategy( {
clientID : FACEBOOK_APP_ID,
clientSecret : FACEBOOK_APP_SECRET,
callbackURL : FACEBOOK_CALL_BACK_URL,
profile : true
}, function(accessToken, refreshToken, profile, done) {
FB_ACCESS_TOKEN = accessToken;
process.nextTick(function() {
console.log("FB_ACCESS_TOKEN : " + FB_ACCESS_TOKEN);
return done(null, profile);
});
}));

In call i am requesting for scope user_status,user_photos and offline_access

app.get('/auth/facebook', passport.authenticate('facebook'), {
scope : [ 'user_status', 'user_photos','offline_access']
}, function(req, res) {
});

To get all albums I am using

app.get('/albums', function(req, res) {
FB.setAccessToken(FB_ACCESS_TOKEN);
console.log("FB_ACCESS_TOKEN @@ : " + FB.getAccessToken());
FB.api('/me/albums', function(resp) {
console.log("Albums " + JSON.stringify(resp));
});
});

But in console i am getting

Albums {"data":[]}

NOTE : I checked the fb javascript example fbrell.com/fb.api/photo-albums In that the scope specified are "user_photos,friends_photos,user_photo_video_tags,friends_photo_video_tags".I just want the photos and so i used user_photos

Any help??

add oauth 2.0 api request features

FB.api should be able to handle calls to https://graph.facebook.com/oauth These return querystring format instead of json - a=b&c=d. errors still return json. So extra care must be taken. this can be accomplished by checking for status code "200 OK", path starting with "/oauth" and content-type containing text/plain.

Does not support images

When requesting an image, either an url or a buffer should be returned. Instead the JSON parser fails and returns an error.

FB.api("/me/picture", {access_token: token}, cb);

doesn't allow fb_exchange_token

When I'm trying to exchange token, I need to send fb_exchange_token but Facebook response is

{ message: 'fb_exchange_token parameter not specified',
type: 'OAuthException',
code: 1 }

Access Token Question

var FB = require('fb');

FB.api('/v2.1/oauth/access_token', {
    client_id: 'id',
    client_secret: 'secret',
    grant_type: 'client_credentials'
}, function (res) {
    if(!res || res.error) {
        console.log(!res ? 'error occurred' : res.error);
        return;
    }

    var accessToken = res.access_token;
    FB.setAccessToken(accessToken);
    console.log(res);
});

FB.api('/v2.1/me/pokes', function (res) {
  if(!res || res.error) {
   console.log(!res ? 'error occurred' : res.error);
   return;
  }
});

Hi, I'm trying to make something like the above code work, but I can't seem to get the access token to be returned to me. When I log the accessToken value its just my client_secret appended to my client_id. This doesn't seem right. How do I get the above code to work as expected? Is this my fault or a bug with this repo?

remove if(cb)

cb = cb || function() {}; cb will never be undefined. so remove checks

What is flow of getting access_token on server-side?

Actually, when you use :

FB.api('oauth/access_token', {
    client_id:     'id here',
    client_secret: 'client secret here',
    grant_type:    'client_credentials'
  }, function (fbres) {
    if (!fbres || fbres.error) {
      totalResult.push(fbres);
});

something like this, you get only id|string (separated by pipe). But its not enough to fully use this API further. We need to get session id from FB api?

How to get it? Can you please provide normal example.

Thank you.

scrumptious sample not working

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

Debug request calls

Is there any way to activate verbose request logs? I tried to set an environment variable as stated on request wiki, but it does not log anything...

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.