How did you implement JWT in your project?
Translate the implementation into a PostgreSQL audit query over JWT tokens and API requests. As of 2025-02-01, summarize every token, including tokens with no requests. Treat a request at or after expiration or revocation as invalid.
token_id, user_id, token_status, request_count, last_request_at, and invalid_request_counttoken_id ascending| Column | Type | Description |
|---|---|---|
| token_idPK | INT | Unique JWT token identifier |
| user_id | INT | Identifier of the token owner |
| issued_at | TIMESTAMP | Token issuance timestamp |
| expires_at | TIMESTAMP | Token expiration timestamp |
| revoked_at | TIMESTAMP | Timestamp when the token was revoked |
| scope | VARCHAR(50) | Permissions encoded for the token |
| Column | Type | Description |
|---|---|---|
| request_idPK | INT | Unique API request identifier |
| token_id | INT | JWT token used for the request |
| requested_at | TIMESTAMP | Timestamp when the request was received |
| endpoint | VARCHAR(100) | Requested API endpoint |
| response_status | INT | HTTP response status code |