• Notice: Undefined property: stdClass::$redirect_code in fboauth_graph_query() (linea 818 di /membri/madebygamers/sites/all/modules/fboauth/includes/fboauth.fboauth.inc).
  • Notice: Trying to get property of non-object in fboauth_action_connect() (linea 84 di /membri/madebygamers/sites/all/modules/fboauth/includes/fboauth.fboauth.inc).
  • 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.

App ID and Secret entered.

admin/config/people/fboauth settings:
Allow anonymous users to connect an existing unconnected drupal account to their Facebook account? CHECKED
Import Facebook e-mail address CHECKED
Import Facebook user picture CHECKED
User name import => Real name (i.e. John Smith)
Request additional permission to the following:

  • [email] E-mail (Strongly recommended to ensure proper account functionality.)
  • [picture] Profile picture

Help me :(

Comments

Criistalx’s picture

Here a screenshot from Facebook APP Settings: http://i62.tinypic.com/dpzuvd.png

Snehal Brahmbhatt’s picture

It 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!

WillsCreative’s picture

I'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

bjoernr-de’s picture

StatusFileSize
new42.57 KB

Facebook 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."

foo

Problem is that this module is build to use the v2.3 API (which is not possible with new Facebook Apps).

AlexKirienko’s picture

Facebook 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.

bjoernr-de’s picture

@AlexKirienko sorry, my bad.

AlexKirienko’s picture

No problem. I have missed v2.4 release. But now I will check it.

Thank you.

bjoernr-de’s picture

StatusFileSize
new644 bytes

Adding 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 /me returned some more information:

{
  "id": "123456",
  "email": "foo@bar.de",
  "first_name": "Foo",
  "gender": "male",
  "last_name": "Bar",
  "link": "http://www.facebook.com/123456",
  "locale": "de_DE",
  "name": "Foo Bar",
  "timezone": 2,
  "updated_time": "2015-07-09T15:13:20+0000",
  "verified": true
}

whereas in v2.4 it only returns the id and name:

{
  "name": "Foo Bar",
  "id": "123456"
}
AlexKirienko’s picture

Version: 7.x-2.0-rc1 » 7.x-2.x-dev
Assigned: Unassigned » AlexKirienko
Priority: Major » Critical
Status: Active » Needs work

v2.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.

bjoernr-de’s picture

StatusFileSize
new4.56 KB

This patch seems to work for me.
Maybe someone with older apps (that support API versions <2.4) can review?

WillsCreative’s picture

I 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

bjoernr-de’s picture

Hi 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.module and includes/fboauth.fboauth.inc?

Also did you configured your fboauth settings properly? In advanced permission settings the "email" checkbox needs to be checked.

WillsCreative’s picture

I 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

WillsCreative’s picture

StatusFileSize
new153.87 KB
kopeboy’s picture

Hey, 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...

bjoernr-de’s picture

Hey 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.

AlexKirienko’s picture

Status: Needs work » Needs review

Hi.

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.

bjoernr-de’s picture

StatusFileSize
new42.62 KB

Thanks @AlexKirienko for testing.
And well, your account was created successfull including your email and profile picture.
No errors in watchdog:
watchdog-log

But I found another bug:
Forcing users to be verified by an administrator after registration throws an error:

Notice: Undefined property: stdClass::$pass in fboauth_action_page() (line 67 of /var/www/testing.bjoernr.de/sites/all/modules/fboauth/includes/fboauth.fboauth.inc).

Will open a new issue for that this evening.
=> https://www.drupal.org/node/2547393

mtoscano’s picture

New 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

tocab’s picture

StatusFileSize
new4.58 KB

#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.

tocab’s picture

StatusFileSize
new4.58 KB

Sorry, the previous patch is wrong (in #20).
Now it shoul be fine.

rroblik’s picture

Hi,

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 somme notice and warning after login a test user with fboauth.

The problem seems to come from fboauth.fboauth.inc file, around line 149

...
$fbuser = fboauth_graph_query('me', $access_token, array('fields' => implode(',', $apiFields)));

// Use fake email if user email not available.
if (empty($fbuser->email)) {
  $fbuser->email = $fbuser->id . '@facebook.com';
};
 
$uid = fboauth_uid_load($fbuser->id); 
...

When I dump the $fbuser variable with me test user here is what I can see :

Array
(
    [data] => {"id":"109897612703519","name":"Margaret Alajdihdagigd Martinazziberg","first_name":"Margaret","last_name":"Martinazziberg","gender":"female","locale":"fr_FR","link":"https:\/\/www.facebook.com\/app_scoped_user_id\/109897612703519\/","timezone":2,"updated_time":"2015-10-19T15:11:36+0000","verified":false,"email":"pybxjmn_martinazziberg_1445267488\u0040tfbnw.net"}
    [redirect_code] => 
    [redirect_url] => https://graph.facebook.com/v2.4/me?fields=id%2Cname%2Cfirst_name%2Clast_name%2Cgender%2Clocale%2Clink%2Ctimezone%2Cupdated_time%2Cverified%2Cemail%2Cinterested_in%2Clocation&access_token=xxx
)

In fact, in $fbuser we've got the return from the fboauth_graph_query method. This, instead of decoding json, returning a "fake" array as we can see arround line 915

  // If the response contains a redirect (such as to an image), return the
  // redirect as the data. i.e. https://graph.facebook.com/v2.3/19292868552/picture.
  if (isset($graph_result->redirect_url)) {
    $data = array(
      'data' => $graph_result->data,
      'redirect_code' => $graph_result->redirect_code,
      'redirect_url' => $graph_result->redirect_url,
    );
  }
  else {
    $data = json_decode($graph_result->data);
  }

Why this if statement ? A redirect_url non empty key do not mean that there is no data inside data key of drupal_http_request ...

Nobody have got the same problem ?
If I comment this if, login is ok.

Regards

JulienF’s picture

For 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

rroblik’s picture

I think you're wrong.
I tried both 7.x-2.0-rc1 and 7.x-2.x-dev and the issue remain here

rgnyldz’s picture

Hi, 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.

ndobromirov’s picture

Hi,

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).

rroblik’s picture

According to @ndobromirov, there is code style issues and not enough (alter) hook to bring this module flexible and very useful (thinking about altering default fboauth_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)

dirckdigler’s picture

I 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.

aldibier’s picture

I'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.

jcmartinez’s picture

Hi.

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:

if (variable_get('fboauth_apiversion', 'v2.3') == 'v2.5') {

to:

if (variable_get('fboauth_apiversion', 'v2.3') == 'v2.4') {

...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.

captainack’s picture

Title: Facebook didn't provide an e-mail address » Facebook didn't provide an e-mail address - API 2.4 and 2.5 updates

Just 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.

captainack’s picture

Category: Support request » Bug report
darrellduane’s picture

Assigned: AlexKirienko » darrellduane
Status: Needs review » Fixed

@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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tyler.frankenstein’s picture

I'm not sure this issue was entirely resolved, particular for first time user account creation. Here's a related issue with patch.

darrellduane’s picture

Status: Closed (fixed) » Needs review
khoomy’s picture