Needs review
Project:
Facebook OAuth (FBOAuth)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
28 May 2015 at 13:41 UTC
Updated:
8 Jun 2016 at 10:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Criistalx commentedHere a screenshot from Facebook APP Settings: http://i62.tinypic.com/dpzuvd.png
Comment #2
Snehal Brahmbhatt commentedIt seems there might be issue in your Facebook App. Please create New App on Facebook and change APP ID & App Secret in Drupal Facebook OAuth Module.
Further, Please let me know which version of Facebook Application you currently working with.
Thanks!
Comment #3
WillsCreative commentedI'm having a similar issue. When I check my fboauth site logs, I see the following message:
"Email address not provided by Facebook." pointing to ?q=drupalgap/fboauth/connect.json
I created a brand new facebook application using API v2.3 and I'm still getting this error. My app is public and approved to use e-mail
Comment #4
bjoernr-de commentedFacebook forces new facebook applications to use their latest API version (latest when creating the app, older apps may access older APIs):
"[...]Any call to a version earlier than this or unversioned call by this app will automatically get upgraded to this."
Problem is that this module is build to use the v2.3 API (which is not possible with new Facebook Apps).
Comment #5
AlexKirienko commentedFacebook API 2.4 was released on July 8 - only 2 days ago.
>WillsCreative commented 17 days ago
>I created a brand new facebook application using API v2.3 and I'm still getting this error.
So it's possible. 17 days ago new facebook app used v2.3, latest at this time.
Comment #6
bjoernr-de commented@AlexKirienko sorry, my bad.
Comment #7
AlexKirienko commentedNo problem. I have missed v2.4 release. But now I will check it.
Thank you.
Comment #8
bjoernr-de commentedAdding the fields to the API query works to get the email address from FB Api.
There might be some other place where code changes are necessary. This is just for the registration.
---
Memo: What about updating user fields by Facebook API fields? Is this working properly? (e.g. users first and lastname etc.)
--EDIT--
According to the v2.4 documentation (https://developers.facebook.com/docs/graph-api/using-graph-api/v2.4):
"By default, not all the fields in a node or edge are returned when you make a query. You can choose the fields (or edges) you want returned with the "fields" query parameter."
In v2.3 querying
/mereturned some more information:whereas in v2.4 it only returns the id and name:
Comment #9
AlexKirienko commentedv2.4 update looks pretty bad in this perspective.
@bjoernr-de, thank you for your research.
I will try to fix find out how to deal with new changes and fix it asap.
Comment #10
bjoernr-de commentedThis patch seems to work for me.
Maybe someone with older apps (that support API versions <2.4) can review?
Comment #11
WillsCreative commentedI applied patch #10 and I still get "Email address not provided by Facebook." in the logs, along with the following messages:
Notice: Trying to get property of non-object in services_fboauth_connect() (line 74 of public_html/sites/all/modules/services_fboauth/services_fboauth.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of public_html/includes/entity.inc).
Notice: Trying to get property of non-object in services_fboauth_connect() (line 75 of public_html/sites/all/modules/services_fboauth/services_fboauth.module).
Notice: Trying to get property of non-object in _user_mail_notify() (line 3613 of public_html/modules/user/user.module).
Notice: Trying to get property of non-object in user_pass_reset_url() (line 2358 of public_html/modules/user/user.module).
as well as some others.. going to revert back. My FB app still shows it's 2.3
Comment #12
bjoernr-de commentedHi WillsCreative,
thanks for your review.
I again tested my patch with a FB app using api version 2.2 and can't reproduce your errors.
Did you use the DEV version "7.x-2.x-dev" of fboauth module and successfully patched
fboauth.moduleandincludes/fboauth.fboauth.inc?Also did you configured your fboauth settings properly? In advanced permission settings the "email" checkbox needs to be checked.
Comment #13
WillsCreative commentedI was using the rc1. I just uninstalled the module and reapplied the patch and attempted to login from my DrupalGap app. I still get a huge list of messages in the log. See screenshot
My facebook app is version 2.3
Comment #14
WillsCreative commentedComment #15
kopeboyHey, the obligatory FB API version is 2.4!
I have a new Facebook App for a new project and I can't retrieve the real user email, just [ID]@facebook.com
You should test with v2.4...
Comment #16
bjoernr-de commentedHey to both,
could you please try to login using the Facebook Connect button on http://testing.bjoernr.de/ ?
This is a new drupal instance with just the standard modules + fboauth in dev version and the patch of comment #10
Login works without any errors and also getting the real email address from the fb api.
Comment #17
AlexKirienko commentedHi.
Yesterday I have tried to test on my local, but fb don't allow me to login on new test app. I have seen error message that test app in still in dev state and I don't have permissions to login. But I have used test app admin account. I will try to check it today again.
I'm sorry for such bad situation, but I didn't have time before. Looks like other maintainers don't have it too.
@bjoernr-de http://testing.bjoernr.de/ works fine. I was create account with my fb account.
Comment #18
bjoernr-de commentedThanks @AlexKirienko for testing.

And well, your account was created successfull including your email and profile picture.
No errors in watchdog:
But I found another bug:
Forcing users to be verified by an administrator after registration throws an error:
Will open a new issue for that this evening.
=> https://www.drupal.org/node/2547393
Comment #19
mtoscano commentedNew Drupal instance with few additional modules + fboauth in dev version and the patch of comment #10 + in advanced permission the "email" checkbox checked, with recently created Facebook app v2.4: account successfully created, including email and profile picture.
Without the "email" checkbox checked the ID facebook email was recorded
Comment #20
tocab commented#10 is not ok for me with a v2.5 Facebook app.
But I have simply added the "email" parameter in the $apiFields array, and now it works fine.
New patch attached.
As bjoernr-de says, there is still an issue if account need to be verified by admin.
Comment #21
tocab commentedSorry, the previous patch is wrong (in #20).
Now it shoul be fine.
Comment #22
rroblik commentedHi,
Even with the last dev version and with the #21 patch applied, I've got the
Facebook didn't provide an e-mail address to be associated with your account, so we can't compare it with the e-mail addresses in this system.message and sommenoticeandwarningafter login a test user withfboauth.The problem seems to come from
fboauth.fboauth.incfile, around line 149When I dump the
$fbuservariable with me test user here is what I can see :In fact, in
$fbuserwe've got the return from thefboauth_graph_querymethod. This, instead of decoding json, returning a "fake" array as we can see arround line 915Why this
ifstatement ? Aredirect_urlnon empty key do not mean that there is no data insidedatakey ofdrupal_http_request...Nobody have got the same problem ?
If I comment this
if, login is ok.Regards
Comment #23
JulienF commentedFor the info, on v2.0-rc1 and FB API v2.5 an email is being returned but it's an internal fb email in the form of XXXXXX@facebook.com
I'm guessing this problem is related to this issue, if it's not the case let me know and I'll create a separate issue.
Thx
Comment #24
rroblik commentedI think you're wrong.
I tried both
7.x-2.0-rc1and7.x-2.x-devand the issue remain hereComment #25
rgnyldz commentedHi, I'm using 2.5 in my app with the dev release. The email adres is imported as XXXXXX@facebook.com. Also the mapped fields are not imported.
The only thing that is imported correctly is the profile picture.
Comment #26
ndobromirov commentedHi,
I had similar issue and tested the patch in #21 it did not fixed the issue for me, I found it in the way the fboauth module was used from custom code...
Either way regarding the patch in #21 there are 2 issues that I found there:
1. Many places where the version is changed as a hard-coded string. It will increase the chance for someone putting a wrong version or miss one from all the places that need changes.
1-a) My suggestion here is to create a constant to be used on all the places, allowing consistent changes (even if through code).
1-b) Variable with no UI for setting it, that defaults to the constant mentioned above in 1-a, so it will allow easy development switch to newer version of the API from settings.php without code changes to the module. Maybe developer docks should be updated then.
2. Many code style issues in the module itself (maybe this is for separate thread/issue).
Either way, I am attaching patch implementing 1-a against patch from #21 + interdiff, so you can check all the changes (including small formatting tweaks).
Comment #27
rroblik commentedAccording to @ndobromirov, there is code style issues and not enough (
alter) hook to bring this module flexible and very useful (thinking about altering defaultfboauth_action_connect()for example)In a perfect world I would say ... this module should be completely rewrite using PSR-4 OOP design :)
(maybe this is for separate thread/issue)
Comment #28
dirckdigler commentedI am agree with RgnYLDZ, I have facebook Oauth version 7.x-2.0-rc1 and API Version v2.5 and email adres is imported as XXXXXX@facebook.com and only work fine is the picture, as can I see API facebook release constantly and is necesary many manteiners to have the stable module
So the question now is what module is ok to import the values and register the user.
Comment #29
aldibierI've solved the problem to get the email user in 7.x-2.0-rc1 adding parameters to the query according to https://github.com/mkdynamic/omniauth-facebook/issues/216
I'm attaching the patch.
Comment #30
jcmartinezHi.
Attached is a patch that solved this problem for me using the v2.5 API and could solve it for people using v2.4 with a little tweak explained below.
Since the problem appears to be only with the latest versions of the FBoauth API I added a configuration element to select the version of the API that you are using. Based on the version selected I implemented a fix that applies only to the v2.5, which is the version of the API that you will get if you create a your Facebook app today (Nov. 2015).
Even though it is possible that this fix could solve the problem for those who have an app created with the v2.4 I didn't implement the fix for cases where v2.4 is selected because I can't test it. Facebook doesn't let me create apps using an older version of their API.
If you have a v2.4 app, after applying this patch to the Dev version of the module, try changing the following line inside fboaut.fboauth.inc
from:
to:
...if the above works for you, let me know and I will create another patch extending this solution to v2.4.
In addition to the above I also added a "Debug" checkbox to the configurations so that we can see the user object that we are getting back from Facebook in the DBlog. I believe this will help us going forward as the API changes.
This patch is against the current Dev version 7.x-2.x-dev.
Comment #31
captainack commentedJust marked #2617612: 2.3 -> 2.5 API changes as a dupe and changed the title so hopefully less dupes are created...
I want to test the patch(es) against a 2.2 and a 2.5 app, but I'm not sure at this point whether I should be testing #21, #26, or #30. #21 seems the shortest and most relevant to JUST this issue without stylistic improvements.
Also, I'm guessing older apps should be fine - the API version number, in their words, is "the OLDEST version of the API" that the app can access.
Comment #32
captainack commentedComment #33
darrellduane commented@jcmartinez, thank you for your patch. I have applied your patch and tested it with a v2.5 Facebook app that I have and it works.
Further, I'm going to give the benefit of the doubt that this patch also resolves the issues that people have been having with v2.4 apps. FBOauth for v2.4 of the facebook API is broken at the moment as well, I've got to believe it is the same issue, and if it isn't, someone will open a new ticket, or update this one. So, I've made the modifications to your patch as you suggested to support both v2.4 and v2.5. I was looking for a way to have the module automatically query the Facebook API to get the version number so we wouldn't have to set it, but I can't find any way. If someone finds something please comment here, I'd rather not have an additional configuration option to have to set (or not be set and get bug reports from).
I would ask that in the future that you please make your patches to modules relative to the directory below the directory that they are for, rather than the full tree of drupal. You happen to keep your modules in /sites/all/modules/contrib, whereas I have mine in /sites/all/modules and I had to deal with that little hiccup.
The debug functionality is awesome, thanks for adding that in as well. I'll commit this to the dev release and if I don't get any feedback about problems with it in the next week, commit it to the full release.
I've also updated the README.txt documentation to account for the new API version setting.
Comment #36
tyler.frankenstein commentedI'm not sure this issue was entirely resolved, particular for first time user account creation. Here's a related issue with patch.
Comment #37
darrellduane commentedComment #38
khoomy commentedhttps://www.drupal.org/node/2744593#comment-11273727