Why header and payload in the JWT token always starts with eyJ

Jwt

Jwt Problem Overview


I am using JWT token to authorize my APIs, during implementation I found header and payload in token always start with eyJ. What does this indicate?

Jwt Solutions


Solution 1 - Jwt

JWTs consist of base64url encoded JSON, and a JSON structure just starts with {"..., which becomes ey...when encoded with a base64 encoder. The JWT header starts with {"alg":..., which then becomes eyJ...

You can try on this online encoder and enter {"alg" and click on encode. The result will be eyJhbGciPSA=

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSuresh PrajapatiView Question on Stackoverflow
Solution 1 - JwtjpsView Answer on Stackoverflow