Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to get authorize code from facebook using Node js

How to get authorize code from facebook using Node js

Problem

Here is my Code about trying to get authorize code in Node js:

var FB = require('fb');
FB.api('oauth/authorize', {
    client_id : '160355604145399',
    redirect_uri : Convas Url
}, function(res) {
    if (!res || res.error) {
        console.log('error')
        console.log(!res ? 'error occurred' : res.error);
        return;
    }
    console.log(res.code);
});

The problem is I always get error information like { code: 'JSONPARSE', Error: [SyntaxError: Unexpected token

Problem courtesy of: Jianyuan Ma

Solution

You have
tags in the code. Probably from copy pasting. Delete them and it should work.

Solution courtesy of: raam86

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

How to get authorize code from facebook using Node js

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×