Closed (fixed)
Project:
Facebook OAuth (FBOAuth)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 May 2014 at 21:04 UTC
Updated:
30 Apr 2015 at 21:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
francoud commentedComment #2
francoud commentedOK, I investigated and I found that - according to the Graph API explorer:
message": "(#12) username is deprecated for versions v2.0 and higher",
Now the question is: how can I force this module, and/or the Facebook apps, to use version 1.0 of the API?
I suspect that newly created apps on FB always use version 2.0... is it true? Please any suggestion?
Comment #3
francoud commentedComment #4
francoud commentedI try to clarify the results of my further investigation.
Since 30th april, Facebook released a new version of the Graph API - 2.0. Newly created apps will by default use the v2.0 version of the API. Tthere are many differences in the 2.0 version - for example, "username" field is no more available, as well as many other objects.
A workaround should be possilble, using a "&version=v1.0" parameter in the graph url. Something like:
graph.facebook.com/v1.0/me
I tried patching the fboauth.fboauth.inc file, using v1.0 in the url... but it didn't worked for me. Maybe because my facebook App is new and cannot use version 1.0? I don't know.
Anyway 1.0 version will not be available anymore, after 30th April 2015. So this workaround could not be useful for long time...
I also discovered that from graph api, we receive a field named "link", which now contains something like this:
https://www.facebook.com/app_scoped_user_id/11216732176231762376/
(this number is not valid, it's just for example)
The numeric part of this url is used to "hide" the original username. I can't find any clean way to convert this number to the corrisponding original username.
I also know that if you use this kind of url in a browser (a valid url, not this fake one, of course), you are redirected to the correct profile. So maybe using CURL we could get the final, effective url. And this could be the... dirty way..? But honestly I don't like very much this approach.. and I'm not skilled in Curl... so I didn't try.
Any comment, help or suggestion would be appreciated!
Thanks to quicksketch for his job on this and other modules, and his answers to my mails :-)
---------------
References:
https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
https://developers.facebook.com/docs/apps/changelog
Comment #5
villette commentedI have the same problem, for my project it's not acceptable to have a full name as a username. Plus, if someone who have the same name as an other person already registered, their username will look something like this : "John Doe.1"
So, I made a patch that gives you the option to use the facebook profile ID (the one in your "link") for the Drupal username.
I know it's not ideal but there is still the possibility to implement hook_username_access to hide this "ugly" username and replace it by another value (let's say data from custom fields attached to the profile)
Comment #6
majdi commentedThis code will let drupal use the email address prefix as user name
dont forget to replace hook with module name
Comment #7
quicksketch> So, I made a patch that gives you the option to use the facebook profile ID (the one in your "link") for the Drupal username.
This solution is probably about the only option available once Facebook removes the 1.x API next month. I think we should actually remove the username option entirely and provide an update hook to switch to real name (which is going to be better than Facebook ID in most cases).
Comment #8
mrded commentedComment #10
AlexKirienko commentedI have used @villette patch and implement @quicksketch suggestion - "remove the username option entirely and provide an update hook to switch to real name"