November 2018
Intermediate to advanced
388 pages
9h 5m
English
The third part of the token is the signature, which is a signed version of the previous two elements. This is shown as follows:
HMACSHA256(base64UrlEncode(header)+"."+base64urlEncode(payload), secret)
Here, we create an HMACSHA256 signed token. We use the base64UrlEncoding of the header, followed by a period, then a base64UrlEncode of the payload, which is the collection of the claims and an HMAC secret.
Depending on the algorithm used, this step of signing the token may vary. However, the idea here is to encode and sign the token with a secret. This becomes the third part of the JWT token.
So, our JWT token is in a format like this:
Base64UrlEncode(header).base64Encode(payload).HMACSHA256(base64UrlEncode(header)+"."+base64urlEncode(payload), ...
Read now
Unlock full access