Have you created a User Pool in Cognito to store the user profile? If you
have configured it correctly, you should get a token when your app call
Cognito to authenticate the credentials. If you get None response, there
could be a configuration issue.

On Tue, Sep 18, 2018 at 9:09 AM <[email protected]> wrote:

> I am changing the login authentication to be handled by AWS Cognito and
> require some clarification around the approach as cannot get it to work
> correctly
>
>    1. I have created a class cog_login that has been assigned to the
>
> auth.settings.login_methods = [cog_login]
>
>    1.
>
>    One of the functions that is in the class is called authenticate()
>    that takes username and password arguments that the user enters from the
>    standard web2py forms user/login
>    2.
>
>    In the def user() controller in default I have the following:
>
> cog_login().authenticate(request.vars.email, request.vars.password)
>
> This queries AWS and returns True if passes, False otherwise.
>
>    1.
>
>    I am not clear on what to do with the True, False response within the
>    def user() as it doesn't seem to populate auth.user which always remains as
>    None.
>    2.
>
>    I have tried to force the population of auth.user getting the contents
>    of auth_user, i.e. auth.user = row[0]. This does populate auth.user
>    performing tests auth.is_logged_in() results in a True response.
>
> However when continuing through the def user() the standard onlogin
> redirect doesn't forward to the main page indicating web2py isnt recording
> this as authentication accepted.
>
>    1. I have also tried a redirect if "auth.is_logged_in()" but the
>    decorators @auth.requires_login on the main page don't detect the login and
>    redirect back to the login page.
>
> ------------------------------
>
> Is this approach correct, I seem to be missing a step that knits the
> successful AWS login to Web2py
>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to