Dear fellow Drupalers,

I've been struggling with this for hours, so I decided to report it as a glitch. If configured OauthConnector to provide authentication to users with their googleapp account and I haven't had any problem fetching name, email, id, etc. However it seems impossible to fetch the user's picture from google apps into the user's profile in Drupal. This is oauthconnector configuration

Avatar
Image for this connection.
Resource: https://www.googleapis.com/oauth2/v1/userinfo

POST request: check or uncheck- doesn't work in either case
Field: picture
Field to match on user profile: Picture

Any idea will be greatly appreciated.

Thanks,

Comments

N20’s picture

Same problem here. While Devel for oauthconnector shows all fields correct including the url to profile picture it's not mapped properly to the user picture field. emailadresse for example works.

ed523’s picture

Issue summary: View changes

subscribing

Erik_S’s picture

Hey,

I'm having the same issue, for pictures.

I feel like I'm very close. We've set up oauth connector for login/ user register page. On the user register page, I've used the module "Register with Picture" to expose the picture upload to the register form. I've used the module "FileField Sources" to allow an image upload to use a URL. I've used the module "User Picture Field" to define a custom field on Users which is linked to the core Picture field. This custom field can be configured to use the URL upload widget on the register page.

The result of this combination is that on the user register page, there is a field_user_picture (custom field) input which can accept either the default file upload *or* a url path to file. The file attached to field_user_picture overrides the core user picture.

At this point I can get oauth connector to print the URL to file for a LinkedIn user's picture in any textbox field (link the textbox to the api call) but I can't get the URL to be printed in the URL upload widget's textbox (probably because it is a custom widget).

I think I need to write a custom field handler or find a way to get Oauth connector to play nice with a custom field.

An alternative (which would *not* be pretty) would be to add a fake text field to the user, hide it with css on the signup page (and everywhere else) and then use javascript to copy the value of that field into the URL upload widget on page load after Oauth connects and pipes the URL to file into that hidden field.

Dananos’s picture

There is a way to get Google User info without requiring the user to log in via OAUTH, by using a service called AvatarAPI,
you can call it via PHP as follows:


$client = new SoapClient("http://www.avatarapi.com/avatar.asmx?wsdl");
$params = array (
    "email" => "john.reid@gmail.com",
    "username" => "xxxxx",
    "password" => "xxxxxx"
);
$response = $client->__soapCall('GetProfile', array($params));
print_r($response);