Hi there.
I'm trying to connect to the Google Contacts API to retrieve contacts from a user's account.
Using the 'ADD PROVIDER FROM PRESET' default for Google, I can successfully allows a user to authorise our site to access the user's Google account.
However, I have problems after changing the scope from :
https://www.googleapis.com/auth/userinfo.profile
to the Google Contacts API scope:
https://www.google.com/m8/feeds/
Now when I try to connect a user's account to the Google account, it results in a user being returned to a screen saying: "Authorization finished, The application has been authorized". We would usually be returned to the user's connection tab with a new connection listed, BUT we are no redirected, there is no new account added to the user's connection tab, and no additional entry in the database's authmap table.
Scratching my head through the debugger suggests that the oauthconnector_oauth_common_authorized() hook is called, but is not bringing anything back from the call to $external_uid = _oauthconnector_fetch_field('uid', $provider, $access_token, $consumer);
What am I missing here?
Hoping this module will continue to evolve as it makes total sense to have a shared api for accessing third party information via oauth2. Documentation is kind of light on the ground at the moment, so I'll be happy to document this once I have it working.
In the mean time, any pointers would be much appreciated.
Comments
Comment #1
frans commentedWhat you describe, is that the field 'User ID' is not correct. That is weird, beacuse for Google it is just 'id'.
Because you have changed the scope I think you need to seek it there.
You can have multiple scopes by putting a space in between them. You need the default (user.profile) for access to the endpoint
https://www.googleapis.com/oauth2/v1/userinfo (where the 'User Id' lives).
Conclusion:
Use both scopes
https://www.googleapis.com/oauth2/v1/userinfo and https://www.google.com/m8/feeds/ and you should be ready to go.
BTW
https://www.google.com/m8/feeds/ gives a 404 and does not look like a valid scope. (AFAIK scopes from google are on the domain googleapis.com). That might be wrong in the documentation from Google? (or it is wrong in my head...)
And documentation is always welcome!
Maybe you can create a page on http://drupal.org/documentation?
Comment #1.0
frans commentedTypo