Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
xamanu CreditAttribution: xamanu commentedI had more luck with the dev version of OAuth Connector module. At least for the email-address it is working fine.
Comment #2
xeeshangulzar CreditAttribution: xeeshangulzar commentedI am facing the same issue.It is just sending user name and email i want to mapped other user fields too.
Comment #3
xaris.tsimpouris CreditAttribution: xaris.tsimpouris commentedFor 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.