All examples use BASE_URL — set it to your deployment URL.
POST/api/jwt/decode
Decode a JWT token and inspect its header, payload, and expiry.
const BASE_URL = "http://localhost:3000";
const res = await fetch(`${BASE_URL}/api/jwt/decode`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U"
})
});
const data = await res.json();
// → { success: true, header: { alg: "HS256", typ: "JWT" },
// payload: { sub: "1234567890" }, expired: null, signature: "..." }