logging in a user from encrypted password

29 views
Skip to first unread message

Lou C

unread,
Jan 25, 2016, 10:10:30 PM1/25/16
to web2py-users
I have a user I have fetched from the db(), I want to return this user's JWT token, but to do so I must log them in first.
Can I log in a user with auth.password property?
valid_user = auth.login_bare(user.username, user.password)
if valid_user:
payload = AuthJWT.serialize_auth_session(current.session.auth)
AuthJWT.alter_payload(payload)
logging.info(AuthJWT.generate_token(payload))
Reply all
Reply to author
Forward
0 new messages