Usability is a high value for us. That includes the usability of our own apps along with how we can help our customers improve their own user experience.
Today let's talk a little bit about the latter. Specifically, let's explore what happens when a user tries to view a page that requires a login.
There are many ways an app can respond to a not-logged-in condition:
1. It can simply show an error message. Thankfully this is not particularly common, but it does still happen. This is not recommended as it creates a dead-end for the user.
2. The app can redirect the user to login, but returns the user to a main page instead of where they originally intended to go.
This is really common. Unfortunately, it sends the user on a detour where they have to remember where they were and how to get back there. The solution is to track where they were so they can be sent back.
3. The app can redirect the user to login, and even return them to an original page. However, if two browser tabs were open to different pages and the browser is reloaded, both tabs end up at the same page, not the distinct, original pages.
Often the original page tracking mentioned above is in the form of a session cookie. The challenge here is with multiple windows or tabs. As each tab reloads, it overwrites the original cookie. The user ends up with multiple tabs at the same URL.
Tracking alone, even tracking only one page, helps a lot, as only a minority of users end up with multiple tabs. However, for power users who work with multiple tabs or windows, it can be a real annoyance.
4. The app can redirect the user to login, and return each tab to its original place.
Instead of tracking with a cookie, use a query parameter that's maintained through the login process. This allows each tab to independently be restored to its original location.
We've added a new parameter to LoginRocket to make it easy to take your app from a level 1 or 2 experience all the way to level 4. It's simply called 'redir'.
'redir' is designed to hold a path containing the original page the user wanted to view. You can pass it as a query parameter to any LoginRocket page and upon successful login (or signup), it will be returned to your app alongside the login token. Once your app verifies that login and establishes a new session, it can use redir to send the user back to where they wanted to be.
We use redir when you login to manage your AuthRocket account. If you want to try it out, go to a non-dashboard page (such as viewing a user or a setting page) and then logout. Log back in and you should be back where you started.