Hi,
I was trying to populate fields form facebook but to no vial could somebody tell me what I am doing wrong because there is really a lack of documentation
Here is my implementation export:

$provider = new stdClass();
$provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
$provider->name = 'facebook';
$provider->title = 'Facebook';
$provider->url = 'https://graph.facebook.com';
$provider->consumer_advanced = array(
  'oauth2' => 1,
  'signature method' => 'HMAC-SHA1',
  'authentication realm' => '',
  'request token endpoint' => '/oauth/request_token',
  'authorization scope' => 'email,read_stream',
  'authorization endpoint' => 'https://www.facebook.com/dialog/oauth',
  'access token endpoint' => '/oauth/access_token',
);
$provider->mapping = array(
  'fields' => array(
    'uid' => array(
      'resource' => 'https://graph.facebook.com/me',
      'method post' => 0,
      'field' => 'id',
      'querypath' => FALSE,
      'sync_with_field' => '',
    ),
    'email' => array(
      'resource' => 'https://graph.facebook.com/me?fields=email',
      'method post' => 0,
      'field' => 'email',
      'querypath' => FALSE,
      'sync_with_field' => 'mail',
    ),
    'name' => array(
      'resource' => 'https://graph.facebook.com/me',
      'method post' => 0,
      'field' => 'name',
      'querypath' => FALSE,
      'sync_with_field' => 'name',
    ),
    'avatar' => array(
      'resource' => 'https://graph.facebook.com/me?fields=picture',
      'method post' => 0,
      'field' => 'url',
      'querypath' => FALSE,
      'sync_with_field' => 'picture',
    ),
  ),
  'format' => 'json',
);

Comments

alessio.digi’s picture

I personally have a working LAMP D7 client with oauth http client and with oauth connector capable of doing login with twitter (oauth1.0a) and facebook (oauth2.0)

I've enabled Connector Action Default Register Form and set in "Registration and cancellation" Who can register accounts as Visitors.

Connector work not perfectly as does NOT import any user data for me at the moment but it let me manually set the user login and password of the new user created then i need to disconnect and reconnect via connector button on the D7 client to have the new user authorized and recognized from the provider and see his account associated with the provider account via oauth.
The user account on the client D7 is now permanently connected (till remove action) to the provider Connection and is External ID and teorically is capable of syncing data with it via a link Sync local profile with provider but this action seems doing nothing .

i've also a a working LAMP oauth D7 server and i can exchange all the oauth dance of token ( using different client as http://googlecodesamples.com/oauth_playground/ or http://term.ie/oauth/example/client.php or a D7 client) but when i try to access the oauthlogin Api service i always get i'm not authorized (not even withouth oauth using just session authentication to view the service resource) and i cannot therefore login using oautconnector on the D7 client .

My implementation export is simplier as i request just uid and name

$provider = new stdClass();
$provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
$provider->name = 'facebook';
$provider->title = 'Facebook';
$provider->url = 'https://graph.facebook.com';
$provider->consumer_advanced = array(
'oauth2' => 1,
'signature method' => 'HMAC-SHA1',
'authentication realm' => '',
'request token endpoint' => '/oauth/request_token',
'authorization scope' => 'email,read_stream',
'authorization endpoint' => 'https://www.facebook.com/dialog/oauth',
'access token endpoint' => '/oauth/access_token',
);
$provider->mapping = array(
'fields' => array(
'uid' => array(
'resource' => 'https://graph.facebook.com/me',
'method post' => 0,
'field' => 'id',
'querypath' => FALSE,
'sync_with_field' => '',
),
'name' => array(
'resource' => 'https://graph.facebook.com/me',
'method post' => 0,
'field' => 'name',
'querypath' => FALSE,
'sync_with_field' => '',
),
'avatar' => array(
'resource' => '',
'method post' => 0,
'field' => '',
'querypath' => FALSE,
'sync_with_field' => '',
),
),
'format' => 'json',
);

obstikle’s picture

Try using the latest dev versions of oauth, connector and oauthconnector. I got pre-population to work using the latest dev versions.

Also, you don't need to add the query to the end of the resource URL. Just use https://graph.facebook.com/me

pedrosp’s picture

yep, it worked for me. kudos!

jasonwhat’s picture

Has anybody got it working importing the users profile picture from facebook to Drupal? I'm trying to play around and figure things out, but there isn't any documentation for guidance that I could find.

N20’s picture

im also looking for picture import. whatever is use for settings, facebook and twitter images are not imported.

remydenton’s picture

Component: Documentation » Code
Status: Active » Closed (duplicate)

It looks like only username and email are supported at the moment-- see https://drupal.org/node/1503258 .

FYI, this functionality is included in 7.x-1.0-beta2, so no need to use the dev version if this is all you need.