Issue with User Preferences Ticket

My tests are passing, but when I click on the button in the UI I get the following error message:
User Preferences: invalid response to update preferences - login of user failed

When using Chrome developer tools, I see that the /login post requests is returning 401 with the following:
{“msg”:“unable to login user”}

Nothing coming out in the log of IntelliJ.

Any ideas?

I have been able to discover that the login isn’t working because a session already exists for the given user. The strange thing is that when I debug the logout method on the UserController class or the deleteUserSessions in the UserDao class, the debugger never shows that the methods are called. When I have a look at developer tools for logout, it says:
“timestamp”: “2020-12-01T15:13:49.835+0000”,
“status”: 400,
“error”: “Bad Request”,
“message”: “Missing request header ‘Authorization’ for method parameter of type String”,
“path”: “/api/v1/user/logout”

I got the same issue, and I find solution in this link:

I think the issue is it is doing a login test after register test, while register test already include a login function. You need to update session when doing second login, need to update CreateUserSession function

@Xiyuan_Feng thanks for the tip it worked.

I got the same issue and fixed the issue (login of user failed) by deleting all the sessions before creating one in UserDao.createUserSession method.