使用说明
MCP Demo - Login App with Session Bug
Demo repository for the "Extend Copilot's Reach with MCP Servers" video.
The Bug
After resetting a password, logged-in users see "Session expired" error.
Root cause: auth/session.js validates sessions by comparing session.passwordVersion with user.passwordVersion. When password is reset, the user's version increments, but the session's version doesn't get updated.
Fix: In server.js after auth.resetPassword(), update req.session.passwordVersion to match the new version.
Quick Start
npm install
npm start
Open http://localhost:3000
Reproduce the Bug
- Login as
demo/password123 - See the dashboard (session works)
- Open
/reset-passwordin a new tab - Reset password for
demoto anything - Go back to dashboard and refresh
- BUG: "Session expired" error!
Demo Credentials
| Username | Password |
|---|---|
| demo | password123 |
| testuser | test123 |