I am trying to understand JWT, and surfing various resource on web. I found the code showing how to check whether JWT is tempered -- this is a great one and I understand it.
However, I don't understand how JWT won't be used by a middle-man who can either look at the browser data (think of a public computer in library) or sniff the wire (I guess this can be avoided by HTTPS though) to get the GWT string, and replay from another computer.
https://float-middle.com/json-web-tokens-jwt-vs-sessions/
[headerB64, payloadB64, signatureB64] = jwt.split('.');
if (atob(signatureB64) === signatureCreatingFunction(headerB64 + '.' + payloadB64) {
// good
} else
// no good
}