Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending static access token #91

Open
milosgacanovic opened this issue Oct 6, 2015 · 1 comment
Open

Extending static access token #91

milosgacanovic opened this issue Oct 6, 2015 · 1 comment

Comments

@milosgacanovic
Copy link

When i try to extend static access token using this code:

FBGraph.extendAccessToken({
"client_id": conf.client_id
, "client_secret": conf.client_secret
}, function (err, facebookRes) {
console.log(facebookRes);
});

i get an error :

{ error:
{ message: 'No user access token specified',
type: 'OAuthException',
code: 1,
fbtrace_id: 'HVYelcFepXD' } }

I've tried also specifying

"access_token": client_access_token

which i get using this code:

FBGraph.authorize({
"client_id": conf.client_id
, "client_secret": conf.client_secret
, "grant_type": "client_credentials"
}, function (err, facebookRes) {
FBGraph.setAccessToken(facebookRes.access_token);
client_access_token = facebookRes.access_token;
});

Everything else works....

@ffflabs
Copy link

ffflabs commented Jan 31, 2018

I use something like:

// current_token is the current user token I want to extend
graph.setAccessToken(current_token);

graph.extendAccessToken({
        client_id: myApp.FACEBOOK_APP_ID,
        client_secret: myApp.FACEBOOK_APP_SECRET,
        access_token: current_token
      },function(err, res) {
        console.log(res.access_token) // this is the renewed access token 
     });

(probably the first setAccessToken is not needed, I can't try it now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants