Closed chrisjhoughton closed 9 years ago
hmm.. looking at the js sdk https://developers.facebook.com/docs/apps/versions adding a version parameter seems ideal. Maybe a version flag within the module so that you won't have to add it every time or you can override it if you pass a version in. Similar to what's being done with the access_token.
So yeah, pretty much what you've just said :+1:
Glad we're on the same page! We're pushing our product live tomorrow and migrating everything to v2.0 is one of the top priorities for us, expect a pull request from me over the next few days. I'll also chuck in the access token fixes from https://github.com/criso/fbgraph/issues/46 as well.
Any idea on how to get the username now? I did read the FB documentation but it is nowhere to be found.
Thank you.
Hi Sneppers, you can use the /me
endpoint, which will contain a link
parameter. See https://developers.facebook.com/tools/explorer?method=GET&path=me&version=v2.0.
Within this fbgraph module, you can get the same info like this:
graph.get("me", params, function(err, res) {
console.log(res); // { picture: "http://profile.ak.fbcdn.net/..." }
});
Note: I wouldn't recommend trying to explicitly get the "username" - not all users have one. Using their link
or id
parameters will give you much more consistent behaviour.
By the way criso, are the tests working for you at the moment? I haven't even merged my changes and I can't get the tests to pass for me.
I think Facebook closed down the link
username loophole. I have a username on Facebook, and when I look at my /me
results now, the link is now using my userid instead of my username. You could probably follow the redirect for the link
, and try to extract the username from that if you really want it.
@chrisjhoughton Haven't had a chance to check that out yet.
Cool, no rush. We've got it forked with the fix in place here: https://github.com/sauce/fbgraph.
FYI, this forked module is now in production for us.
Awesome. The tests have historically been flaky since the connect to FB. Been meaning to change that for a while now. But I need a couple more hours in the day for that ;)
I can totally relate there! Would you like me to submit a pull request for the new version of shall I wait on you for the tests?
Sure, I think leaving it defaulted to version 1 is the way to go. You a typo on a comment btw: " * - adds the graph API version, defaulting to 2.0"
Thanks for your point on the typo - will get that resolved.
Out of interest, what's your thought process behind leaving it set on version 1? Setting on this version will certainly help for now, but as things change over time and Facebook eventually deprecates 1.0, even if 1.0 is set in setGraphVersion
, the developer will be forced over to 1.1. In some ways defaulting to the newer version would make life simpler for new developers using fbgraph.
Thoughts? See https://developers.facebook.com/docs/apps/versions
Setting to version 1 is purely for the immediate backwards compatibility. Don't want anyone doing a npm update and having to spend time fixing things.
@chrisjhoughton are you still planning on a pull request for this?
@criso ah yes, I'll make the changes and submit! FYI - in Graph 2.1 (released yesterday), JSON responses are always returned by the API. (No more booleans)
is this by default targeting v1.0 ? me/friends returns 2.0 result, which is just total count. I havent tried prefixing the call with v1.0 so v1.0/me/friends but i assumed this api was targeting 2.0+ by default
Facebook automatically targets the oldest version by default, currently v1.1. (Which is not a real version, it's a clone of 1.0)
Hey, what's the status? I would like to use the new v2.1 api. Btw @chrisjhoughton, as I can see your fork doesn't change the URL for oauth (here).
Sorry for the delay guys, I'm on this now. Will have a pull request in the next hour or so. Thanks @xpepermint for the pointer! I'll re-fork.
hello, is this updated for v2.0+ facebook api ! i would like to hear if it is upgraded!
@shivasurya Yes it version-ed for 2.0 ++
This is more of a discussion opener than a direct issue at this stage, but if you haven't seen - Facebook's just announced a ton of new changes to their API. Most notably for this module, they'll be versioning the API moving forwards.
They've now introduced v2.0, with a number of little tweaks and changes. It would be great to hear what your thoughts are on things. I'd definitely recommend some kind of
version
global parameter, but to allow for flexibility it should be possible to specify this on the request level as well.Thoughts?