Yes. With token-based authentication, the client sends the access token on every request to a protected API, in the Authorization header using the Bearer scheme: GET /api/trips HTTP/1.1 Host: api.example.com Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9... Why every request? - REST APIs are stateless: the server does not remember the user between requests, so each request must prove who is calling. - The API validates the token each time — signature, issuer, audience and expiry — and builds the user's identity (ClaimsPrincipal in ASP.NET Core) from its claims. With JWTs this validation is local and fast; there is no database lookup per request. How the client does it - Angular: an HTTP interceptor adds the header to every outgoing API request. - React: a shared fetch or axios wrapper adds the header. - Mobile apps: the HTTP client is configured the same way. - Only attach tokens to your own API's domain, never to third-party URLs. "Bearer" means whoever holds the token can use it, like cash. Therefore: - Always use HTTPS so the token cannot be intercepted. - Keep access tokens short-lived (often 5–60 minutes) and renew them with a refresh token. - Store tokens carefully: in memory or secure storage on mobile; avoid localStorage where XSS could steal them. A Backend-for-Frontend with HttpOnly cookies is a strong alternative for browser apps. - Never put tokens in URLs or logs. (One exception: browser WebSocket and SignalR connections, which cannot set headers, pass the token in a query string, which must then be excluded from logs.) Alternative: cookie-based authentication, where the browser sends a session cookie automatically on every request. Same principle — every request carries proof of identity — but the browser handles it, and you need CSRF protection.
Ravindra Wadile · · 0 likes