@dan.woda Ok I used the code provided by you. The console logs however are not really helpful because this part already works as expected.
Console output:
When using this user data:
I planned on integrating the redirection into the if/else statements so only unauthorized users get redirected. This is not possible on the application side and that’s why this workaround is really needed. But at this point a logout before redirecting would be useful to obtain security and prevent more errors. That’s my problem here.
Unfortunately something with the hook is not working correctly. There is just nothing that happens with this hook. See also this thread: