I’ve got a route and a bit of code to login as another user, but when you click the link, you are logged in as the new user, but if I press back in the browser it goes back to a restricted link and errors as the user doesn’t have access. How can I log in the user and basically disable the back button? Previously I have use javascript to open a new tab and close the old one, this works, but sometimes there is a weird timing issue where the original tab doesn’t close.
2
Answers
In the link handler, probably in controller you check, if the current user is logged in as another user, you get request back by:
Else (meaning nobody is logged in and need to show an error) – show an error
Read authentication, authorization and middleware from laravel documentation.