Added authentication with google and namespace support for sfMelodyUserFactory::createUser#51
Added authentication with google and namespace support for sfMelodyUserFactory::createUser#51tquensen wants to merge 6 commits intochok:masterfrom
Conversation
…dn't work anyway) (Namespace requires the scope "https://www.googleapis.com/auth/plus.me" in the app.yml (again, this does not work with the "api" config param as namespace and scope are different) Access own (public) google+ Profile info via $melody->ns('plus')->get('people/me');
|
Works now with google+ :) |
Uses the google+ ID if available, the email otherwise (or null if none is available)
There was a problem hiding this comment.
the problem was, that a call to $melody->get('people/me') was changed to 'people/default/full'
use scope: [https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile] in app.yml and call $melody->ns('oauth2')->get('userinfo') to get the userdata and the unique iserid even if the requested account doesn't have a google+ profile
|
I have changed the getIdentifier method to use only a single call. |
|
I´m using this file version but doesn´t works |
|
@zarpax what exactly "doesn´t work"? |
|
@tquensen, Sorry for the delay. I've been making new tries and all works ok. In my first try I couldn't connect with google (Token error) |
There was no useful way to get basic user info for google accounts, so a added some changes:
a new "userinfo" namespace in the google class: https://www.googleapis.com/userinfo
the required scope is "https://www.googleapis.com/auth/userinfo.email", so this does not work with the api config (for whatever reason, scope is different to namespace)
As this is not the default namespace, i added a parameter "namespace" to use with the user configuration.
So, to authenticate with google and retrieve the email, use this config: