Giter VIP home page Giter VIP logo

facebook-node-sdk's People

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

facebook-node-sdk's Issues

How can I use it in ReactJS Project?

`import React, { Component } from 'react';
import { Grid } from 'semantic-ui-react';
import FB from 'facebook-node-sdk';
import './SignUp.css';

class SignUp extends Component{

constructor(props) {
super(props);

}
function(){
var fb;
fb = new FB(({ appID: 'xxxx', secret: 'xxxxx' });)

fb.api('/get', function(err,data){
console.log(data);
})
}

render(){
	return(
		<div className="message">
		<Grid divided="vertically" columns="equal">


		<Grid.Row>
		<Grid.Column>
		<div className="UserDetails">

		</div>

		<div id='social-login-button-facebook'>
			
			
			<div className="fb-login-button" data-max-rows="1" data-size="medium" data-button-type="login_with" data-show-faces="false" data-auto-logout-link="true" data-use-continue-as="false"></div>
		</div>
		</Grid.Column>
		</Grid.Row>


		</Grid>
		</div>

		);
}

}

export default SignUp;`

What is the correct way of using it in ReactJS?

error: Invalid OAuth access token signature.

Hi!

I am trying to get started; and I have this very simple code :

var Facebook = require('facebook-node-sdk')

var facebook = new Facebook({
    appID: 'my app id',
    secret: 'my app secret'
})

facebook.api('/me', function(err, data) {
  console.log(err, data)
})

I don't know what's the problem, but I keep getting this error :

{ result: 
   { error: 
      { message: 'Invalid OAuth access token signature.',
        type: 'OAuthException',
        code: 190 } },
  code: 0,
  message: 'Invalid OAuth access token signature.' }

did I miss something very basic?

node crash Facebook.BaseFacebook.hasCookie

It seams that the function BaseFacebook.prototype.hasCookie crash:

TypeError: Object object has no method 'hasOwnProperty'

Correction :

BaseFacebook.prototype.hasCookie = function(key) {
return this.request && this.request.cookies && Object.prototype.hasOwnProperty.call(this.request.cookies, key);
};

Documentation typo

Under your Synopsis section your reference "appID" when it should be "appId"

This version worked for me:

var facebook = new Facebook({ appId: 'YOUR_APP_ID', secret: 'YOUR_APP_SECRET' });

getLogoutUrl

Can i get example how to use getLogoutUrl with express. I currently get url and if it gets visited user is logged out from facebook but somehow i still get user data from api.
I guess its somehow related with session?
Full example would be appreciated.

Tests fail in current version of node.js

After scrolling pages & pages of:

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

it finally gets this:

node.js:0
// Copyright Joyent, Inc. and other Node contributors.
^
RangeError: Maximum call stack size exceeded
npm ERR! Test failed. See above for more details.
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0

I'm using node v0.10.23. What is the latest version of node that this sdk works with?

Thanks,
Bruce

x-forwarded-host is blindly trusted

In BaseFacebook I see 2 methods that blindly do something like headers['x-forwarded-host'] || headers.host.

The x-forwarded-host is not trustworthy, it can only be trusted if you know that there is a reverse proxy directly in front of node that sets it (express has it's own config for this). Otherwise x-forwarded-host can be manipulated to anything by the client.

DEBUG: CSRF state token does not match one provided.

HI guys, I follow this example..

var express = require('express');
var Facebook = require('facebook-node-sdk');

var app = express.createServer();

app.configure(function () {
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: 'foo bar' }));
app.use(Facebook.middleware({ appId: 'YOUR_APP_ID', secret: 'YOUR_APP_SECRET' }));
});

app.get('/facebook', Facebook.loginRequired(), function (req, res) {
req.facebook.api('/me', function(err, user) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello, ' + user.name + '!');
});
});

I changed the APP_ID and SECRET, and this si the error on CONSOLE of node.js

186.128.69.137 - - [Tue, 22 Oct 2013 01:19:44 GMT] "GET /facebook HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.

186.128.69.137 - - [Tue, 22 Oct 2013 01:20:05 GMT] "GET /facebook?state=SFvWsUvhf4YWqxW2CWrc69Up4xxQrXLK&code=AQB8Uv2CC3oeL2IuMotTQoPGSDeOO5PwTyFRuI1ir3vxpE2w_UKQnAZjusdm6xdEIewforKJh_Rdl6Q7O7HqMe9BmGvZBaehiyLNO6INlt0Dc-HdcAv_clXMw_5Rt1w-YwyAw05FIvffqQAYJhQImpLQU1q6dcJsdjMozIfvToHOYUeu19OvlGGzZsCgkRzecQyxLi1y68jAj9BJGjKl1CKYXd_8kzKc2IdMy6aaCNY7oD2n-8yml9dDbq-IwmWFsif_Coz2VA9fpNDV7kEHsLB5k_uTKzyuVOcgyYGIZBq7s9z1wvv9kuuswnAjhdbwOQA HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:06 GMT] "GET /facebook?state=KZK5sWOa5XDvSH8he0BnI61ACmTMV5VN&code=AQCNpRx28ptsreJ65Sf0z0tyAQg4upFR3Hkdek96mKFU_S8emIkGneChIMXMuMvdnv_lkHpWsHFq9r8B1dE2Mo6InSvZ7ol6tByPno3JqbsA8mBEXrWPEYb3wC1hftfhr7vkY2bL7xVsXM1jUulYT7Co5CNm26evJF0bhYcfJYdeJRXyaUjfmEMsx1nIGgHx7-acC5hDV3z3diUeFsx9i6TcglxLKjRPJS2cj9e1KOKDqLiXNkmHxjLNghuRPUC0w65qPIN2OT6P28vSy08ODyEtBxe-UuiacUnZme_9m6J80gSAhBgPLf_a4Bh66ugcQ8w HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:07 GMT] "GET /facebook?state=RFfnmAEvjg3MbDbSg4lLkFWXSTqWGNDx&code=AQCib_fACG6ir2sCrprxCQ9LtTEOV5Ps9WMuXGnnUJgaD3XtFQgaR5u6Ty8PhTOUp990VjXhcLSqGHlHOUlHBnM67YBOHdRp1OsMwcORIIrXoki84iQql8j-ppfrrGwRDrz3tl0GgKjXUkiWzBGjckJlTLL6yk8csyqv-tKHhRqsdWMHW2tBYnCf3DxeE9kEZHBA1Zu53_hB6SDO5NJKYZqQJq5V5GxT10M9kRllYFaOJMzauBFVQ6utGOK-xPUM1KJbrHsNQUIkvWVPHqbDvUHCQz4ZS49t1OIS83WYSHacMfG-4MsIy_bR5RL9IRbN88c HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:07 GMT] "GET /facebook?state=W1fstecjqc313G9tIdmlGkNyWivAcmjj&code=AQDWMAVy3ihP6v7FIJeifEtOKKpmRZLRsUe-urIChXtVl71M0Jily5B_sdXs5Gztl8gwzQiv3alNXx9O1c1HcEnkhngO8VGLTpTt9iF4QMa2aMcLSTwuaN5dyaYcEmXVhcDMjxd64UckBaM2x7ibZNesg1tnbNpgQTdtHeHZc00oYsMDhSiZ7NfV5-9ugCwouZ5NFE8PvFrDuJP3K6IB-IrPQcG-cS31cErsBeiaw7gmmj0RozS24zXtTe-Pwl1tp7qeyNcuJDkwYyyVQZgO7ozvFIJXZaepk9YJwDB9hwUIr3Fq3CXqKZbW7CO_W1XeHKE HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:08 GMT] "GET /facebook?state=SEjupInnAIA3S1GCCDv8eWZ81Mj9V0yj&code=AQB3756PLUmaOXxZDZN4DJiQSqm5Ydu7g4ju7o1zBfHPRc9yoVRXkVfDhDMj2y1L6_UcNr5ffRuuu7tY0o1qsjREsXIYfxtvxwoqAPuAsKyw5Fa0nj9MEqFmFH0ebRF5MGsI_2YjCCc5eh84-UqiEutIorOTjsh0RfGNXkSy7_83F-cN5zi8ILAFgo2hItf0Srkh2bVN7kGftqovrrSZQN5QT3jzXTXbXQoQ1KHw8TGm7u0DJQnA6MIGP8y_eW8wQtu6ObQzCYCddWsZkoBEWb6czfA3iNdmfBcd3E2PQ8uIkmHwFlRTTtKchKEwUmReCAM HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:08 GMT] "GET /facebook?state=541E4e00iLTk8E8dV8avQQjY8i12hgA8&code=AQAZttOqVwdwR_eIG51zYZM0lhbr7fvp3TR_yEI2PYzRBwMGDHWLAKrAI-hHcqKmu78scL-tXnXdwQiUEemo2MMxItDGGzb_vaWXptar_vyvwzg4ek_-Ib_HgB3FA7F-7aGdZ2xBofW8IbaPY3O0eVN11xz9x77GhTVUafGMWnqLZGMKBMtk9ofRRsv8wL_ANix6RtAd-6zH_Hsptlj-7kg6mbKF8Lw29Jeh8YOLpIoOcD_3NSyltFFHBk_AfxPU7rs-0QVCnhLGuYZu0V1AO0J7ze2r0Fy0Fgr7jqANE1RhAwS-ksowq_eZ_jKJ8R_Cslg HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:09 GMT] "GET /facebook?state=Zu9tLNcadggJJVp5iau7BJ6gfjB98RKX&code=AQD3YlabhRkD8m3BK-6trFdpKPCUxEwXfwkY_6sl-0k3cFi6YcdOWyhE6fmcJ6_0gRh25DY9rlJjkr7GS6Lv58upF7i9O7mqQU6i_K6-NHJv-age--reeVTpE5AHQlpMNOehzFBVVITO2eoAoOI5EF1XmFOgN76VxHt3-M7NvlWbSkxe82Q1Jla7ptaGuLUreIkjSVPxh84U7UaWSUuFicmG83WMOfo6hQBZIFLLKx0nYdILEuH0aKfhGHFd2Zc5vAA5z3N5sVTTzKMOCyMX0H-Oj2sIRp3WxjiZLzblU7kbbNug7IB5Bs4mx_9MhkaJxPo HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:10 GMT] "GET /facebook?state=mHSCMrskpiI45y57HytlaVC0hjXpK1Z3&code=AQC_f9LpUPoAtatPGFA3KONyApqRhTlaA8wyjbrhqPGyEESRq78ppycqLATOsxFJNEwKNAkQ9NqJNIxSczpGXrWcnX_1dwA3TlGdWs0JpUAdodCNEhouw76Q5bofpSO-QvVv_yC_6hNJ6a61KEyoe7naFM7TMGVKiCd7tRc53KNxMKNJMX7faU9LXLRxvB8KxC_mUJPdg-0N4cP55LMv3pEW86aL7FePXnodOdhdefigrinue7WpS2RGrgUj7YvtY0szvozfXHiSqdeJHJV4EwS1Fh44AV0gYwd1ML-gbJwYSkctceI920fJGW4rC95lKDg HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:10 GMT] "GET /facebook?state=dmeiA4lPj9CDi95aeZqySZnlaQ2pwuO8&code=AQDntLKU_PfOdZ2Di9c2abEuQoUOhaBXByFTtJ6khWxI61iGxO4XRx8rqKMzN1YE5fk1uVabXyUK5Berw_gvim0_Dh9b_7lONDgQcRraNVGSMd-UcDaLrQmjzD1pEkVuG84WqHYvH6Qd560EsJdNc6HsSkCAYsj8MkixTF0MZdnevfaWjfxW7PPedANbcL-jVAkHZ5yx97oKW_RBJbro2BwiOfHPZNGxeFQWUhVYC21PFppVlT-zhwyj8lQpjJ1ZofOVKcuUbJoh9eMB3GZY0XUTxwM1cpc3v5SSgrf5tI0dBH9VPxFe06FI2-tZxsIeeUk HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

DEBUG: CSRF state token does not match one provided.
186.128.69.137 - - [Tue, 22 Oct 2013 01:20:11 GMT] "GET /facebook?state=uZJ8bTwRreAQFDTJcAavLjTFXTFNMsoB&code=AQAycMzjr1zoTYxgwCItD0a046YIoUYku0kCMkpiyRU6F-0OoqzihWyCLYtrcS3Tft0bJ9PVJ8NhK17y-IvN5q_ZynzeCN953kFbpZ0i2agG-PRpJwiGHeXFgKj0JQ56UcCKsAtWNQrY-BvkGbLJb2f2vLUcZ8bZ9nFBusBV9m14hXE5kg1M-7jbzGTF4PPI7vadGT74SptclPUoaEpToUQnYpaXtAbOrGtEp4fKKwdWhCmEbfoZigJ6jReE2itNFA84vZ1yhC-oPRp2y5rjEwe_mA9z5tH33ErFRO6OTR3w_4iztMBVhpC1oMGEnICpGfQ HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"

On Crhome, this is the message:

This page have a infinity loop

GET "/{ID}/picture" causes end of input error.

When using facebook.api("/{ID}/picture") I am receiving the error:

"Error: Parse Graph API server response error: Unexpected end of input"
EDIT: completely missed the fact that it is a parsing error, I checked the response variable inside the graph api callback just before it calls JSON.parse and it is equal to ""

The setup is working properly with all other requests, can't track down whats going on.

Unable to retrieve single page

Most likely this is something I am doing wrong but, all I want to do is retrieve a set of fields for a particular page. I have written the following:

var appId = foo;
var appSecret = bar;
var token = baz;

var Facebook = require('facebook-node-sdk');
var facebook = new Facebook( { appID: appId, secret : appSecret });
facebook.setAccessToken(token);

facebook.api('/15254154654', 'GET', {"fields" : "id,name" }, function(response) { console.log(response); });

Every single time this returns a 'null' response. I cannot for the life of me figure out the reason. I have run the query inside the Explorer and it works fine but, this fails.

Any ideas ?

how to retrive email and other thing using this module

var express = require('express');
var Facebook = require('facebook-node-sdk');
var app = express();
var pic;
var cover;
var data;
app.configure(function () {
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: 'password' }));
app.use(Facebook.middleware({appId:'my app id ',secret:'my app secret', scope: 'email'}));
});

app.get('/', Facebook.loginRequired(), function (req, res) {

req.facebook.api('/me?fields=cover',function(err,cover_pg){
    cover=cover_pg.cover.source;
    });

req.facebook.api('/me?fields=email,name,id',function(req,res2){
    //res.writeHead(400, {'Content-Type': 'text/plain'});
    data= res2.email.email;
    });
console.log('Hello, ' + pic +"\n" +cover+ "\n"+data+'!');

});

Unable to retrieve facebook response headers

Facebook responses include set of very useful headers, but these are unreachable by this library.

Header x-page-usage is returned whenever your page access token is about to be rate-limited (warning). When any of returned metrics exceeds 100(%), all requests with this token fail.
To be able to schedule / scale requests, an application must be able to read x-page-usage header from client.

Facebook headers looks like this:

x-fb-debug:P5opAiBX...==
x-fb-rev:2440951
x-fb-trace-id:CM4d8Rx7cCs
x-page-usage:{"call_count":855,"total_cputime":202,"total_time":911}

I propose a new option 'response_headers'. When set to true, response object will include response_headers property with response headers.

Example fails

The example in the read me fails with this error in my browser:

The parameter app_id is required

I also found it was using obsolete express.js method 'createServer()'. What versions of node components are required for this example?

Thanks,
Bruce

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.