+ 1

Login form

In what way should I modify my web code so that user don't need to login everytime when he/she open my web page. I am using firebase. My approach:- User will enter their name, I will save it in LocalStorage then using getItem I will get the name then, I will extract the information of that user from realtime firebase database. Is my approach okay or there any other way to achieve such result?

16th Feb 2025, 1:31 PM
You
You - avatar
6 Answers
+ 1
Dipankar Debnath Btw, you're also right, I must have to avoid duplicate names in order to use my approach which is not better at all Thank you for your suggestion. And thanks to JaScript too.
20th Feb 2025, 3:39 AM
You
You - avatar
0
If your approach is to save the username in local storage and everytime they open the website, it get the username from localstorage and automatically login then your approach is wrong. For example your username is "user1" and you want to saw the personal details of "user2" then you can just edit the "user1" to "user2" and thus when you will reload the page will fetch user2 as username and will login into another account.
18th Feb 2025, 11:09 AM
Dipankar Debnath
0
Dipankar Debnath How better if i avoid duplicate name?
20th Feb 2025, 3:32 AM
You
You - avatar
0
Dipankar Debnath While if I use firebase Authentication 's persistent feature, it also save the authentication state in LocalStorage.
20th Feb 2025, 3:37 AM
You
You - avatar
0
You personally I have never used firebase so I don't have any idea. If you need further assistance let me know !!
20th Feb 2025, 1:37 PM
Dipankar Debnath