My team is going to build a single-page-application for our future project. At the moment, I have a problem with designing the app with login page. There are 2 approaches:
- Create the login page as a separate page, the rest of the app is another single page.
- The app has only 1 page and the login page will be a view in the app which is switched back and forth using javascript.
I don't know which approach I should take. I have read some discussions on the internet, it seems like it's more popular to create the login page as a separate page, the reason for this is we can use normal cookie-based authentication with session on server, redirect users to default page (main page) after successful login, and so on. Therefore, I'm thinking about creating the login page as a separate page, but I have a problem with deep linking.
For example, let's say I have 2 pages: login.html
, index.html
(main page). When an unauthenticated user requests a page like this index.html#product=1
, the user will be redirected to the login.html
, after successfully loging in, redirect the user back to index.html#product=1
. But at this point, the #product=1
is lost.
Please advice me on how to keep the deep link or should I take the second approach? Thank you