On Tuesday, December 10, 2019 at 9:50:47 PM UTC-8, Daniel Guilhermino wrote:
>
> Hi,
>
> 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.
>
>
> http://web2py.com/books/default/chapter/29/09/access-control?search=oauth#Customizing-Auth
>
> 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:
>
> var page = 'https://myurl.com/oauth2callback?first_name=' +
> profile.getGivenName () + '& last_name =' + profile.getFamilyName () + '&
> email =' + profile.getEmail ();
> 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?
>
> Thanks in advance!
>
> Best regards,
>
>
Daniel
>
Perhaps I'm being a little slow, but I don't see "ident" in your URL ('var
page = ....'), but you try to pull it out of request.vars[] in your
callback.
Am I missing something?
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/2104cde0-2a9f-4139-af66-d3f962aabcf8%40googlegroups.com.