Home › All prompts › Logins, Tokens and JWTs in Plain English
Mini pack
Free
Logins, Tokens and JWTs in Plain English
It's hard to tell whether your vibe-coded login is actually secure: tokens you can decode in a browser, personal data sitting in a JWT, or a Log out button that only deletes a cookie. These 9 free prompts help you see how login works in your app, read what's inside your tokens and cut extras, check the server really verifies them, store sessions safely, and make logout end the session for real.
Understand what your app does when someone logs in, see what's inside your tokens, check the server really verifies them, and make logout really log out.
9 prompts in 4 sections. Replace everything in [BRACKETS IN CAPS], then copy and paste into your AI tool.
Claude Code, Cursor's Agent or Codex: 8 of the 9 prompts need a coding tool opened in your project. Prompt 1.2 can be pasted into any AI chat, because it uses a made-up example token. Prompts 1.1 and 1.2 only explain; 2.1, 2.2, 3.1, 3.2 and 3.3 report first and wait for your OK before changing code; 4.1 writes a test plan for a test account and asks before saving tests; 4.2 shows the file before saving.
Any login provider: the prompts aren't tied to one provider and ask the AI to follow the provider's current docs instead of writing a custom login. Supabase is used as the example in tips: its always-present email and phone claims, user_metadata being editable by users, 1-hour default access tokens, Pro-plan session limits, the HTTP-only cookie trade-off and the session_id check were checked against Supabase's Auth docs (Sessions, JWT Claims Reference, Row Level Security).
JWT and session basics: "readable by anyone, protected against tampering," decode vs verify, and the "none" algorithm warning were checked against jwt.io's introduction and RFC 8725; cookie flags, localStorage advice, server-side expiry and server-side logout against OWASP's Session Management Cheat Sheet.
No stats or X claims: the pack quotes no numbers or posts.
Written for use with Claude Code, Cursor's Agent or Codex. Not yet tested against them.
1.1 Explain How Login Works in My App, in Plain English
Untested: not yet run against a model.
Use this when your login works but you couldn't explain it to a friend. It's for a step-by-step walkthrough of your own app's login, from typing a password to loading a private page, with nothing changed.
Fill in: [WHAT MY APP IS] (e.g. "a Next.js recipe app with Supabase"), [HOW PEOPLE LOG IN] (e.g. "email and password, plus Google", or "not sure").
Don't create or change any files. Explain how login works in my app, like I'm new to this.
My app: [WHAT MY APP IS]
How people log in: [HOW PEOPLE LOG IN]
Please:
1. Find the code and settings that handle login, logout, and checking who's logged in. List the files and what each one does in one line.
2. Tell me which login provider or library I use, if any, and its version.
3. Walk me through what happens, step by step, from the moment someone types their password to the moment they see a private page. For each step, say whether it happens in the browser, on my server, or at my login provider.
4. Tell me what kind of token or session I use (a JWT, a random session ID, or something else), where it's stored in the browser, and how it gets sent with each request.
5. Explain each technical word the first time you use it, in one plain sentence.
6. End with a short list of anything you couldn't find or aren't sure about. Don't guess.
Tips to customize: If the answer is long, ask for "a 5-line version I could explain to a friend" afterwards. Save the full answer, because Prompt 4.2 turns it into a page you keep in your project.
1.2 If Anyone Can Read a JWT, Why Is It Considered Secure?
Untested: not yet run against a model.
Use this when you've seen that anyone can decode a JWT and it made you nervous. It's for a plain explanation of the difference between reading a token and changing one, using a made-up example instead of a real token.
Fill in: [WHAT I'VE HEARD] (e.g. "someone said anyone can decode a JWT, so I'm scared my login is broken"), [MY LEVEL] (e.g. "total beginner", "beginner who can read some code").
Explain JWTs to me in plain English. I'm a [MY LEVEL]. Here's what I've heard: [WHAT I'VE HEARD]
Please use a made-up example token, not a real one, and explain:
1. The three parts of a JWT and what each one is for.
2. Why anyone who has the token can read the middle part (it's encoded, not encrypted), and what "encoded" means.
3. What the signature does: why changing even one letter of the middle part makes the server reject the token, as long as the server checks the signature with a key only it has.
4. So what "secure" means here: people can read it, but they can't change it without getting caught. And what it doesn't mean: it doesn't hide anything.
5. What should never go in a JWT, and why.
6. The two real ways things go wrong: a server that reads the token without checking the signature, and a token that gets stolen while it's still valid.
7. A three-question quiz at the end so I can check I understood.
Keep it short, with one everyday comparison at most, and say plainly where the comparison stops being accurate.
Tips to customize: The official JWT introduction at jwt.io says the same thing: a signed token is protected against tampering but readable by anyone, so don't put secret information in it unless it's encrypted. If you want to look at a token yourself, use one from a test account and ask your coding tool to decode it on your computer rather than pasting it into a website.
Section 2: What's Inside Your Tokens
2.1 What's in My Tokens? Find Personal Data and Strip What I Added
Untested: not yet run against a model.
Use this when you want to know exactly what your tokens say about your users, or you suspect the AI stuffed extra details like a phone number into them. It's for a list of every claim, what it's for, and which extras to remove.
Fill in: [MY LOGIN PROVIDER] (e.g. "Supabase Auth", "my own code with the jsonwebtoken package", or "not sure"), [WHAT I'M WORRIED ABOUT] (e.g. "I saw an email and phone number in the token").
Don't change anything yet. Show me exactly what goes into the tokens my app creates or receives, and help me cut what doesn't belong.
Login provider: [MY LOGIN PROVIDER]
What I'm worried about: [WHAT I'M WORRIED ABOUT]
Please:
1. Find every place my code creates a token, adds claims to one, or reads claims from one. Include cookies, custom claims, and anything my code or the AI added on top of my provider's defaults.
2. Make a table: each claim, where it comes from (my provider's standard claims, or my own code), what it's for, and whether anything in my app actually uses it.
3. Flag anything personal or private I added myself: phone numbers, addresses, birthdays, payment details, internal notes, API keys, or passwords. Also flag any token or session data that ends up in URLs, logs, or analytics.
4. For my provider's standard claims, tell me what its docs say about them, and don't suggest removing claims the provider requires.
5. For each extra I added, suggest where it should live instead (usually my database, looked up on the server when needed).
6. Show me the plan and wait for my OK before changing any code.
Tips to customize: Some providers put certain user details in every token by design. For example, Supabase's JWT claims reference lists email and phone as claims that are always present and can't be removed. That's a provider decision, so focus on what you added yourself. Supabase's docs also warn that user_metadata can be changed by logged-in users, so it should never decide what someone is allowed to do.
2.2 Is My Server Really Checking the Token, or Just Reading It?
Untested: not yet run against a model.
Use this when you want to be sure your server rejects fake, edited, or expired tokens. It's for finding any place that reads a token without checking its signature, or that trusts what a token says about roles.
Fill in: [WHERE MY SERVER CODE IS] (e.g. "API routes in app/api", "Supabase edge functions", or "not sure"), [MY LOGIN PROVIDER].
Don't change anything yet. Check how my server handles tokens on every request.
Server code: [WHERE MY SERVER CODE IS]
Login provider: [MY LOGIN PROVIDER]
For every API route, server action, and backend function that needs a logged-in user:
1. Show me how it gets the user. Does it verify the token's signature, or only decode it? Flag any use of a "decode" function where a "verify" function should be.
2. Check that verification sets which signing algorithm is allowed, and never accepts a token with the algorithm "none".
3. Check that it rejects expired tokens, and checks the issuer and audience if my provider uses them.
4. Check whether any route trusts a role, plan, or user ID that came from the browser (a request body, a URL, a header, or a claim users can edit) instead of from a verified token or my database.
5. Check that my signing secret or private key is only on the server, not in browser code or committed to the repo. Show only the first 4 characters of anything you find.
6. If I use a provider, tell me the function its docs recommend for getting the logged-in user on the server, and whether I'm using it.
7. List the problems from most to least serious, with the file, line, and a plain-English fix. Wait for my OK before fixing anything.
Tips to customize: The jwt.io introduction explains the difference: decoding just turns the token back into readable text, while verifying checks the signature with a key. The IETF's JWT best practices (RFC 8725) say libraries must let you pick the allowed algorithms, and warn that some libraries have trusted tokens set to "none" without checking any signature. If the AI finds problems, fix one at a time and run Prompt 4.1 after each fix.
Section 3: Where Tokens Live and How Long They Last
3.1 Where Are My Tokens Stored, and Should They Move?
Untested: not yet run against a model.
Use this when you've heard "never put tokens in localStorage" and want to know if that applies to your app. It's for finding where your tokens live and getting advice that fits your login provider, not generic rules.
Fill in: [MY LOGIN PROVIDER], [MY FRAMEWORK] (e.g. "Next.js App Router", "React with Vite", "plain HTML and an Express server").
Don't change anything yet. Tell me where my app stores login tokens in the browser, and whether I should change it.
Login provider: [MY LOGIN PROVIDER]
Framework: [MY FRAMEWORK]
Please:
1. Find where my access token and refresh token (or session ID) are stored: a cookie, localStorage, sessionStorage, memory, or somewhere else.
2. For any cookie, tell me whether it's set with HttpOnly, Secure, and SameSite, and explain what each one does in one plain sentence.
3. Explain the trade-off in plain English: page JavaScript can read localStorage, so a cross-site scripting (XSS) bug could steal a token from there. An HttpOnly cookie can't be read by JavaScript, but it's sent automatically, so it needs protection against cross-site request forgery (CSRF).
4. Tell me what my provider's docs recommend for my framework, and whether my setup matches. If my provider has an official package for server-side login in my framework, tell me its name.
5. Recommend one of: leave it as is, change a setting, or move to my provider's recommended setup. Explain why in two sentences.
6. If you recommend a change, show me the plan and wait for my OK. Don't write a custom login system.
Tips to customize: OWASP's Session Management Cheat Sheet advises against keeping tokens in localStorage or sessionStorage and prefers HttpOnly, Secure, SameSite cookies. Providers don't always fit that rule, though. Supabase's sessions docs say HTTP-only cookies only work for apps that do everything on the server, because browser code needs to read the token. So the right answer depends on your setup, and either way, preventing XSS matters most. Ship It Safe Prompt 4.2 checks for XSS.
3.2 How Long Do My Logins Last?
Untested: not yet run against a model.
Use this when people seem to stay logged in forever, or keep getting logged out at annoying moments. It's for finding every timer in your login and setting values that fit your app.
Fill in: [MY LOGIN PROVIDER], [WHAT MY APP HOLDS] (e.g. "workout logs, nothing sensitive", or "people's health notes and payment history"), [WHAT'S HAPPENING] (e.g. "I logged in a month ago and I'm still in", or "users get logged out mid-form").
Don't change anything yet. Find out how long logins last in my app and help me pick sensible settings.
Login provider: [MY LOGIN PROVIDER]
What my app holds: [WHAT MY APP HOLDS]
What's happening: [WHAT'S HAPPENING]
Please:
1. Find every timer: how long an access token lasts, how long a refresh token or session lasts, any inactivity timeout, any maximum session length, and any cookie expiry. For each, say whether it's set in my code, in my provider's dashboard, or left at the default.
2. If a value lives in my provider's dashboard and you can't see it, tell me where the setting is according to the provider's current docs, and ask me to check it. Don't guess the value.
3. Explain in plain English how the access token and the refresh token work together in my app, and what a user notices when each one runs out.
4. Check that the server enforces expiry, not just a timer in the browser.
5. Suggest values that fit what my app holds, explain the trade-off between safety and convenience, and tell me which settings may need a paid plan according to my provider's docs.
6. Wait for my OK before changing any code.
Tips to customize: OWASP's cheat sheet says expiry must be enforced on the server, because anything kept only in the browser can be changed. Supabase's sessions docs say most apps should keep the default 1-hour access token, that sessions last until sign-out unless you set limits, and that the time-box and inactivity limits are on Pro plans and up. Check your own provider's docs, because defaults and plans change.
3.3 Make Logout Actually Log Out
Untested: not yet run against a model.
Use this when you're not sure clicking "Log out" really ends the session, or you need a "log out everywhere" button after a lost phone or a changed password. It's for checking what logout does on the browser and on the server.
Fill in: [MY LOGIN PROVIDER], [WHAT I NEED] (e.g. "a normal logout that really works", "a 'log out of all devices' button", "log users out when they change their password").
Don't change anything yet. Check what happens when someone logs out of my app.
Login provider: [MY LOGIN PROVIDER]
What I need: [WHAT I NEED]
Please:
1. Find my logout code. Tell me what it clears in the browser (cookies, localStorage, memory) and what it ends on the server or at my provider.
2. Explain in plain English what happens to an access token that was copied before logout. Can it still be used, and for how long?
3. Check that the refresh token or session is ended on the server, so it can't be used to get a new access token.
4. Check whether changing a password or email ends the user's other sessions, and whether my provider does this for me.
5. For [WHAT I NEED], show me the simplest way to do it with my provider's built-in features, with a link to the docs page you're relying on.
6. If it matters for my app, suggest an extra check for the most sensitive actions only (like deleting an account or changing payment details), not for every request.
7. Show me the plan and wait for my OK.
Tips to customize: OWASP's cheat sheet says logout must end the session on the server, because deleting a cookie doesn't stop a copy someone already stole. With short-lived JWTs, a copied access token can keep working until it expires. Supabase's sessions docs say signing out removes the session, and for the rare actions that need a hard guarantee, you can check the token's session_id against the auth.sessions table. For most apps, a short access-token lifetime is enough.
Section 4: Prove It Works
4.1 Try to Fool My Login: Edited, Expired, and Logged-Out Tokens
Untested: not yet run against a model.
Fill in: [ONE PRIVATE API ROUTE OR PAGE] (e.g. "/api/notes" or "the dashboard page"), [WHERE TO TEST] ("my local dev server" or "my staging site").
Help me test that my server rejects bad tokens. Use only a test account on [WHERE TO TEST], never real users or my live site.
Route to test: [ONE PRIVATE API ROUTE OR PAGE]
Write me a test plan I can follow, with the exact steps or curl commands, for each of these:
1. No token at all. Expected: rejected.
2. A valid token from my test account. Expected: allowed. This is the control test.
3. The same token with one letter changed in the middle part. Expected: rejected.
4. The middle part edited to say I'm a different user or an admin, keeping the old signature. Expected: rejected.
5. A token with the algorithm in the header changed to "none" and the signature removed. Expected: rejected.
6. An expired token (tell me how to get one safely, such as waiting out a short test expiry, rather than changing my live settings). Expected: rejected.
7. A token copied before logging out, used after logging out. Tell me what my setup should do here and why.
For each test, tell me what a pass looks like (like a 401 or a redirect to login), and what to do if it fails. Then, if I want, write these as automated tests in my project's existing test setup, show them to me, and wait for my OK before saving.
Tips to customize: Test 7 depends on your setup: as Prompt 3.3 explains, a copied access token may keep working until it expires, and that's normal for many JWT setups. Tests 3 to 5 should always fail to get in. To check that one user can't open another user's data, run Ship It Safe Prompt 3.2 next.
4.2 Write My Login Health Card
Untested: not yet run against a model.
Use this when you want a short page in your project that explains your login, so you (or the AI, next month) don't have to work it out again. It's for a one-page summary with your current settings and the open problems.
Fill in: [WHERE TO SAVE IT] (e.g. docs/LOGIN.md), [WHAT I'VE ALREADY CHECKED] (e.g. "ran 2.2 and fixed the decode problem, ran 4.1 and all tests passed").
Write a one-page summary of how login works in my app and save it to [WHERE TO SAVE IT]. Show me the file and wait for my OK before you save it.
What I've already checked: [WHAT I'VE ALREADY CHECKED]
Include these sections, in plain English, with nothing invented. If you can't confirm something from the code or my settings, write "not checked yet":
1. How login works, in 5 lines.
2. My login provider and library versions.
3. What's in my tokens, and what I deliberately keep out.
4. Where tokens are stored and why.
5. How long tokens and sessions last, and where each setting lives.
6. What logout does.
7. How the server checks tokens, with the file names.
8. Tests: which ones exist and when I last ran Prompt 4.1.
9. Open problems, most serious first.
Never include real tokens, secrets, keys, or user details in this file.
Tips to customize: If you have a rules file like CLAUDE.md or AGENTS.md, add one line pointing to this page, like "Read docs/LOGIN.md before changing anything about login." Update the page whenever you change login, and run Prompt 4.1 again.
Get new free packs in your inbox
Optional. Every prompt here is free, and you don't need to sign up to use any of them. We email when we add new free packs. Unsubscribe anytime.
Thanks, you're on the list. Watch your inbox for the next prompt drop.