How do apps or website remember their users?

whenever i went to landing page of gmail, amazon, flipkart, facebook, youtube even at coding blocks etc, it directly make me login automatically. how do they do that? i mean when i open amazon it shows my name. amazon… how do they remember their user login? how do they automatically make me login? what is the coding behind it? for example in future if i make a website and i want to add this feature in my webpage then how would i add this feature? like when i open to gmail it directly opens my inbox. how? i think you have got my point… these apps or websites always remember my name no matter i open their website or application… how do they do that? please explain…

They save everything related to your id/password in cookies. Consider cookie as your local storage. Until the user clears them manually, data stored in them does not get cleared. These websites store their auth-tokens in these cookies and when you go back to these sites they send this auth-token to the database. This auth-token is verified and then the user is automatically logged in if it is right.
I would recommend you to read about this more on: https://www.freecodecamp.org/news/everything-you-need-to-know-about-cookies-for-web-development/

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

so if i want to add this feature in my website then how to add it? i mean what would be the code for it? or it will be managed by the browser by default.???

I would recommend you to read about this: https://www.w3schools.com/js/js_cookies.asp and try the steps given in it