Hi Dave!

I have tried several ways proposed in this chapter of the book, I will 
devote the next few days to try again, as this is the only part of my 
project pending for publication ...

Thanks for the tip, I'll be back here with news ... and hope they are good!

Best regards!

Daniel Guilhermino

Em quinta-feira, 12 de dezembro de 2019 21:44:15 UTC-3, Dave S escreveu:
>
>
>
> On Thursday, December 12, 2019 at 9:44:45 AM UTC-8, Daniel Guilhermino 
> wrote:
>>
>> Hi,
>>
>> Any ideas what parameters should I pass to *auth.settings.login_form()*?
>>
>>
> From the book, 
> <URL:
> http://www.web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms
> >
> it appears that you're supposed to pass a new class instance.
> The book includes an example class for Facebook (Graph API),
> and mentions importing the X509 class (in-box)
> from gluon.contrib.login_methods.x509_auth import X509Account
>
>
> From tools.py, there seems to be a CasAuth class used when web2py is the 
> provider.
>
> Since I haven't tried  implementing an OAuth2.0 deployment, I can't give 
> you more detail.
>
> /dps
>
>  
>
>>
>>
>> Em quarta-feira, 11 de dezembro de 2019 08:54:10 UTC-3, Daniel 
>> Guilhermino escreveu:
>>>
>>> You're right!
>>>
>>> But I've tried with 'ident' arg too... and return None.
>>>
>>> I believe I am not passing all the correct arguments to:
>>>
>>> *auth.settings.login_form()*
>>>
>>> Thanks Dave!
>>>
>>> Em quarta-feira, 11 de dezembro de 2019 04:41:14 UTC-3, Dave S escreveu:
>>>>
>>>>
>>>>
>>>> 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/e29f195c-91f2-4178-bdac-fd2cb93af67f%40googlegroups.com.

Reply via email to