Here lies the ramblings of a madwoman; bumbling her way around in the darkness in an attempt to understand the wide world of websec…
JWT
):
Now, let’s go a little deeper, shall we?
JWT
based on credentials, and provides it to user (following below structure).
RS256
algorithm, the generated JWT
is signed with the server’s private key, and verified by the client with the server’s public key.
JWT
structure - https://jwt.io/)JWT
, which is stored in the client’s local storage/session storage/as a cookie. AKA, the state lives as a token on the client, instead of on the server (as is with typical session-based authentication).
JWT
with the server’s public key, if using the RS256
algorithm.JWT
is stored & sent.
JWT
is stored as an HTTP
-only cookie that is passed to the server with every request.
SameSite=Strict
& additional CSRF
tokens with each request.JWT
is stored in the local/session storage
, meaning it’s not sent with every request. Instead, it must be manually passed into the request header (e.g. Authorization: Bearer <token>
) when authorising.base64
encoded, not encrypted - so sensitive data should never be stored in JWTs, as anyone with the token can decode and read its contents.HTTP-only
cookie, which is stored in the client browser’s cookie jar (a storage for key-value pairs - how cool is this name though-)CORS
(Cross Origin Resource Sharing) or third-party cookies.
CORS
: when a web app makes a cross-origin request (e.g. example.com
to api.example.com
), the browser sends an additional CORS
preflight request to check if the server (api.example.com
) allows the cross-origin request. If it does, it needs to respond with the appropriate CORS
headers.credit where credit is due, this is from ChatGPT, but it was used as a sanity check after I did the bulk of the manual research to build a basis of understanding. so, what am i saying by this? take… all of it with a grain of salt lol-
Helpful Resources: