Custom user authentication not working

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!

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

just for understanding,
what does users function do?

I'm going through exact same issue.
It is mandatory to define the users function, if yes then can you please give me a look of users function and what it does??

Closed this old thread (please continue on your new thread)