Custom user authentication not working

#1

I'm just trying to use Custom user authentication example.

authenticate: function(username,password) {
    return new Promise(function(resolve) {
        // Do whatever work is needed to validate the username/password
        // combination.
        if(username === "test" && password === "password") {
            valid = true;
        }
        else
            valid = false;
        if (valid) {
            console.log("Right");
            // Resolve with the user object. Equivalent to having
            // called users(username);
            var user = { username: "test", permissions: "*" };
            resolve(user);
        } else {
            // Resolve with null to indicate the username/password pair
            // were not valid.
            resolve(null);
        }
    });
}

If I write a wrong password I get this:

But if I write a correct password I get this:

In postman I get the correct answer:


And my browser stores the token:

So is like Node-RED is not storing the token...

is it a bug, or am I doing something wrong?

Thx!

0 Likes

#2

What does your custom auth's users function look like?

0 Likes