Load field editing
🔑 Fill in the payload and key to generate the token
Expiration time - | Token length 0
💡 Instructions for use
- The header has a fixed declaration type and signature method; the payload is the business field you fill in; the signature is calculated by the key and is used to allow the server to confirm that the content has not been modified.
- The payload is only encoded but not encrypted. Anyone who gets the token can decode it and view it. Therefore, information such as passwords, keys, and certificate numbers must not be written in.
- Issuance and verification share the same key, which should only be stored on the server or in a safe location on the local machine; the debugging key must be distinguished from the online key.
- If the server returns unauthorized, check in a fixed order: whether the token is complete, whether the fields are complete, whether the key is consistent, whether the expiration time has passed, and whether the request header is correct.
Which fields should be added one by one by yourself.
Edit mode
Add or delete fields one by one by name and value.
You can also directly paste a piece of object text to replace it as a whole.
Value type
Text, numbers, booleans, and nested objects are all acceptable.
Time fields are expressed as numbers in seconds.
Common fields
User ID and role permission scope.
Issuance time, expiration time, issuer, and audience.
Naming suggestions
Use short English for field names to facilitate cross-language docking.
Do not use multiple different names with the same meaning.
Things to note
The payload can be decoded and viewed by anyone.
Do not write passwords, ID numbers and keys into the payload.
Keep field names as short and uniform as possible; the payload can be decoded, and sensitive information should not be written in.
📖 Glossary
- JWT
- A credential format that passes information in a string consisting of three dot-separated pieces of content. The recipient can directly read the fields, but only the party holding the key can sign a valid signature, so it is suitable for delivering claims but not for storing secrets.
- head
- The first paragraph describing the token's own information usually only describes the type and signature algorithm used. The content is fixed and public, and does not contain business data. Therefore, in most scenarios, the default values can be directly applied, with very few changes required.
- load
- The second segment carries business fields, such as user ID, role, issuance time and expiration time. It is plain text that can be decoded and viewed by anyone with the token, so passwords, keys, or sensitive personal information must not be included, which is one of the most common misuses.
- signature
- Use the key to calculate the check value of the first two segments to form the third segment. Its function is to allow the recipient to confirm that the content has not been changed: as long as one character changes in the first two paragraphs, the signature will not match. This is also the basis for the token to be used to verify identity.
- HMAC signature
- A way to calculate and verify message digests using the same key. The same key is used for issuance and verification, so the key should only be saved by the issuer and the server, and cannot be distributed to the front end or public channels, otherwise anyone can forge the token.
- Key strength
- The lower limit of signature security. Short keys or common phrases can be tried one by one, and once tried out any token can be forged. It is recommended to use a random string of sufficient length and replace it regularly as required by the server, while retaining the old key for smooth transition.
- Expiration time
- The field in the payload indicating the validity deadline, based on which the verifier rejects expired tokens. It is the primary means of limiting the impact of a breach: the shorter the validity period, the smaller the window in which the token is available after being acquired by others, at the expense of more frequent renewals by the holder.
- Issuance time
- The field that records the time when the token is generated can be used to determine whether it is old or new and to troubleshoot anomalies. It is used in conjunction with the expiration time, and the verifier calculates the remaining validity period accordingly; if the two are inconsistent, for example, issuance is later than expiration, it means there is a problem with the generation logic.
- Issuer and Audience
- Two fields are respectively declared by whom to issue and for whom to use. When multiple services share a set of keys, they can prevent tokens issued by system A from being used by system B. The field itself does not provide protection and requires active checking by the verification party to be meaningful.
- base64url encoding
- In order to allow the token to be safely put into the URL and request header, the binary result is encoded with character replacement and de-padding. It is not encryption, just encoding, and anyone can restore it, so don't mistakenly think that the token is protected when you see something that can be decoded.
- Stateless verification
- The server can determine whether the token is valid based only on the signature and fields, without saving session records. This brings the convenience of horizontal expansion, but the price is that it cannot be revoked immediately: after the token is issued, it is valid until expiration, and if it needs to be revoked, it can only be combined with an additional blacklist mechanism.
- Security Boundary for Tokens
- What it guarantees is that the content has not been tampered with, it does not guarantee that it will not be stolen, it does not guarantee that the transmission is encrypted, and it does not guarantee that the identity of the holder is true. The three needs to be borne by transmission encryption, validity period control and business verification respectively. It is a common misunderstanding to place security entirely on the token format.
🔗 All keywords and tutorials
❓ FAQ
- Will the key be uploaded??
- No. The entire signing process is completed within the browser, and the key is not sent anywhere.
- Can I customize the algorithm??
- This tool uses the HMAC digest signature method to facilitate connection with common servers, and the algorithm cannot be switched.
- Can the payload be filled in Chinese??
- Yes, it can still be decoded correctly after encoding; it is recommended that the field names be in English to facilitate docking.
- How to calculate expiration time?
- Convert the number of minutes you fill in to an absolute time to write the payload, and the page will also display the expiration time.
- Can the generated token be put online directly??
- It can be used for debugging; for formal environment, please issue it from the server and keep the key properly.
- Will build records be saved??
- No. The results are only displayed on the page and copied when needed. The page does not save any content.