I can't seem to get the Google field mappings to work and I'm wondering if anyone else have a working setup.

I'm using these modules:

  • OAuth Connector 7.x-1.0-beta1
  • Connector 7.x-1.0-beta1
  • OAuth2 7.x-1.0-beta1
  • OAuth 7.x-3.0
  • Http Client OAuth 7.x-2.4
  • Http Client 7.x-2.4

And this is the connector export:

$provider = new stdClass();
$provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
$provider->name = 'google';
$provider->title = 'Google';
$provider->url = 'https://accounts.google.com';
$provider->consumer_advanced = array(
  'oauth2' => 1,
  'signature method' => 'HMAC-SHA1',
  'authentication realm' => 'authorization_code',
  'request token endpoint' => 'none',
  'authorization scope' => 'https://www.googleapis.com/auth/userinfo.profile ' . 'https://www.googleapis.com/auth/userinfo.email',
  'authorization endpoint' => '/o/oauth2/auth',
  'access token endpoint' => '/o/oauth2/token',
);
$provider->mapping = array(
  'fields' => array(
    'uid' => array(
      'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
      'method post' => 0,
      'field' => 'id',
      'querypath' => 0,
      'sync_with_field' => '',
    ),
    'mail' => array(
      'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
      'method post' => 0,
      'field' => 'email',
      'querypath' => 0,
      'sync_with_field' => 'mail',
    ),
    'timezone' => array(
      'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
      'method post' => 0,
      'field' => 'timezone',
      'querypath' => 0,
      'sync_with_field' => 'timezone',
    ),
    'name' => array(
      'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
      'method post' => 0,
      'field' => 'name',
      'querypath' => 1,
      'sync_with_field' => 'name',
    ),
    'avatar' => array(
      'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
      'method post' => 0,
      'field' => 'picture',
      'querypath' => 0,
      'sync_with_field' => 'picture',
    ),
  ),
  'format' => 'json',
);

The authentication works perfectly and an account is created, but it's completely empty.
I've tried enabling QueryPath and/or POST requests, but nothing I do seem to work. Any ideas?

Comments

xamanu’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Active » Postponed (maintainer needs more info)

I had more luck with the dev version of OAuth Connector module. At least for the email-address it is working fine.

xeeshangulzar’s picture

I am facing the same issue.It is just sending user name and email i want to mapped other user fields too.

xaris.tsimpouris’s picture

For some weird reason, only mail and name are allowed to be saved. I made a hack and now it accepts custom fields too. I'll try to upload a patch.