I\'m using a login form for a small project in Spring but I have a small problem which is that every time I log in using a sign in form I get an error redirection.
T
You can add the always-use-default-target param to the success URL.
.defaultSuccessUrl("/home",true)
This means that if the login is successful you will always be sent to /home.
I think the undesirable behaviour is caused by the error page being queued for some reason, and then when the login is successful you get "returned" to that.
This isn't the ideal solution but providing you don't want to go to the previous page after logging in, then it works to prevent your described behaviour.