HS256 vs RS256
Shared secret or public key - the choice decides who is able to mint tokens.
Open this lesson in the learning hubKey points
- HS256 is symmetric: one secret both signs and verifies.
- That means every service that can verify a token can also forge one.
- RS256 is asymmetric: the auth server signs with a private key, everyone verifies with the public key.
- So a resource server can validate tokens without ever holding the power to issue them.
- Public keys are published at a JWKS endpoint, letting the issuer rotate keys without redeploying consumers.
With HS256, everyone who can check a token can also forge one - that is the whole argument for RS256.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the JWT Authentication Course course, and every lesson in it is listed on the JWT Authentication Course contents page.