Skip to content

Commit 5d25462

Browse files
🖊️ Note why as_object() is missing in FAQ (#230)
1 parent 6aabc2e commit 5d25462

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/faqs.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This is the expected behaviour. While the integrity of tokens is ensured by the generated/verified hash,
88
the contents of the token are only **encoded and not encrypted**. This means you can be sure the token
9-
has not been modified by an unauthorized party, but you should not store confidential information in it.
9+
has not been modified by an unauthorized party, but you should not store confidential information in it.
1010
Anyone with access to the token can read all the claims you put into it. They can however not modify
1111
them unless they have the (private or symetric) key used to generate the token. If you need to put
1212
confidential information into it, current industry recommends generating a random id and store the data on your
@@ -37,6 +37,16 @@ auto token = jwt::create()
3737
The signature includes both the header and payload, according to the RFCs... changing the payload would cause a discrepancy.
3838
That should result in the token being rejected. For more details checkout [#194](https://github.com/Thalhammer/jwt-cpp/issues/194).
3939
40+
### Why does `jwt::basic_claim` have no `as_object()` method?
41+
42+
This was brought up in [#212](https://github.com/Thalhammer/jwt-cpp/issues/212#issuecomment-1054344192) and
43+
[#101](https://github.com/Thalhammer/jwt-cpp/issues/101) as it's an excellent question.
44+
45+
It simply was not required to handle the required keys in JWTs for signing or verification. All the the mandatory keys are numeric,
46+
string or arrary types which required type definitions and access.
47+
48+
The alternative is to use the `to_json()` method and use the libraries own APIs to pick the data type you need.
49+
4050
## Build Issues
4151
4252
### Missing \_HMAC and \_EVP_sha256 symbols on Mac

0 commit comments

Comments
 (0)