Masonite - TypeError > encoding without a string argument when using the Auth login method

3.3k Views Asked by At

When logging in i keep getting a TypeError > encoding without a string argument exception. I am doing it with the out of the box LoginController that ships with Masonite.

The login route is fine but it keeps throwing this exception when logging in.

Here is the code snippet:

def store(self, request: Request, auth: Auth):
    if auth.login(request.input('email'), request.input('password')):
        return request.redirect('/home')

    return request.redirect('/login')
1

There are 1 best solutions below

1
Joseph Mancuso On

This is most likely because one of your inputs are missing. If one of the inputs is missing it will be of value None which will cause this exception.

Check the value of password and make sure it is not of type None.