I have been trying to use Google Sign-in on web2py through the book example, but Google allows us to receive user information on the same login page after the user has entered the login data.
I'm following this flow:
web2py login page -> google login page -> web2py login page (receiving user data) -> check and login page -> authorizes access.
With google's js feature:
function onSignIn (googleUser) {
var profile = googleUser.getBasicProfile ();
}
I can get the data:
profile.getGivenName ()
profile.getFamilyName ()
profile.getEmail ()
and was redirecting the page to check and authorize access:
window.location.href = page;
In the oauth2callback controller:
Already tried:
registration_id = request.vars ['ident']
email = request.vars ['email']
first_name = request.vars ['first_name']
last_name = request.vars ['last_name']
class GoogleOAuth (OAuthAccount):
def get_user (self):
return dict (first_name = first_name, last_name = last_name, email = email)
auth.settings.login_form = GoogleOAuth ()
Already tried:
auth.settings.login_form = lambda profile: dict (registration_id =
request.vars ['ident'],
email = request.vars ['email'],
first_name = request.vars ['first_name'],
last_name = request.vars ['last_name'])
And always the result is None.
Has anyone been able to implement or knows about it?