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

Does this package have graph.setAppsecretTime(appsecret_time)? #132

Open
harishankards opened this issue Sep 28, 2017 · 1 comment
Open

Comments

@harishankards
Copy link

With the docs, I can see that there is no feature as of now. With facebook's graph is needing appsecret_time as a required parameter, how can we achieve that?

as we get error
{ error:
{ message: 'API calls with a community access token require an appsecret_proof and an appsecret_time argument',
type: 'GraphMethodException',
code: 100,
fbtrace_id: 'EdXhSAgyCdy' } }

You have graph.setAppsecret(app_secret) already. Please tell me how to resolve the appsecret_time dependency.

@ffflabs
Copy link

ffflabs commented Jan 31, 2018

The appsecret_proof is generated on:

fbgraph/lib/graph.js

Lines 121 to 128 in 894fa31

// add appsecret_proof to the url
if (sessionAccessToken && appSecret && url.indexOf('appsecret_proof') === -1) {
var hmac = crypto.createHmac('sha256', appSecret);
hmac.update(sessionAccessToken);
url += ~url.indexOf('?') ? '&' : '?';
url += "appsecret_proof=" + hmac.digest('hex');
}

It would need to be changed to:

  // add appsecret_proof and appsecret_time to the url
  var appsecretTime = Math.floor(Date.now() / 1000);
  if (sessionAccessToken && appSecret && url.indexOf('appsecret_proof') === -1) {
    var hmac = crypto.createHmac('sha256', appSecret);
    hmac.update(sessionAccessToken + '|' + appsecretTime);

    url += ~url.indexOf('?') ? '&' : '?';
    url += "appsecret_proof=" + hmac.digest('hex');
    url += "&appsecret_time=" + appsecretTime;
  }

however, it seems this package is no longer mantained, so I wonder if it's worth making a pull request.

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