How a server identifies a user from page to page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How a server identifies a user from page to page

I met with this problem when I was thinking to do a little project with nodeJS. Let me give you a description about my question. So assume you are using a social media and logged with your username. If you want to see about your profile then you would probably type in the URL or just navigate via a button. After a while you will land on a page that will mention about you and some additional tools - like settings, edit, etc But when you landed into a profile of another user you won't see those tools for edit contents, etc, etc. My question is how the server identifies the user in this way from page to page and gives the content according to the user

7th Apr 2019, 11:24 AM
Seniru
Seniru - avatar
3 Answers
+ 7
//Its controlled by cookie and session stuff maybe, for exe if user details stored on session == user profile then give access to profile, if not then don't give access to edit account
7th Apr 2019, 11:33 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 6
there are two ways viz: statefull and stateless @statefull : sessions are kept in servers memory and client has a cookie, browser sends the cookies to the server with every request. @stateless : nothing is stored in servers memory ie server does not know the state of user (logged in/ not logged in) client gets a auth token on login , client stores the token ands sends to the server for all requests p.s. for further information search session management using cookies and stateless rest api
7th Apr 2019, 12:18 PM
code learner
code learner - avatar
0
Obviously, this is a back-end concern. Read on full-stack development Seniru Pasan
8th Apr 2019, 7:04 AM
Da2
Da2 - avatar