This visual execution compares session-based and token-based authentication in Node.js. When a user logs in, the server verifies credentials. For session-based auth, the server creates a session stored in memory or database and sends a session ID cookie to the client. The browser stores this cookie and sends it automatically with each request. The server checks the session ID to authenticate. For token-based auth, the server creates a signed JWT token containing user info and sends it to the client. The client stores the token and sends it manually in the Authorization header on requests. The server verifies the token signature and expiry to authenticate. On logout, session-based auth destroys the session on the server, while token-based auth requires the client to delete the token. This means session-based auth needs server storage and management, while token-based auth is stateless and easier to scale. The execution table and variable tracker show each step and how data changes. Key moments clarify common confusions about storage, client sending methods, and logout behavior.