diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-16 18:06:24 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-16 18:06:24 +0300 |
commit | 04e26cfb286cbc71346a217021012bd82077c66f (patch) | |
tree | 82ac6c518620f66fabbafe9ea6aa51f398ecef13 /contrib/libs/jwt-cpp/README.md | |
parent | 94e0d1dcb0474eb63e528acc76a3be90dc43163b (diff) | |
download | ydb-04e26cfb286cbc71346a217021012bd82077c66f.tar.gz |
intermediate changes
ref:4a4d54c4c155707e6ff62c98153351075e49f4a8
Diffstat (limited to 'contrib/libs/jwt-cpp/README.md')
-rw-r--r-- | contrib/libs/jwt-cpp/README.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/libs/jwt-cpp/README.md b/contrib/libs/jwt-cpp/README.md index 5dcdd10c51..5fc1459412 100644 --- a/contrib/libs/jwt-cpp/README.md +++ b/contrib/libs/jwt-cpp/README.md @@ -54,12 +54,23 @@ auto token = jwt::create() .sign(jwt::algorithm::hs256{"secret"}); ``` +Here is a simple example of creating a token that will expire in one hour: + +```c++ +auto token = jwt::create() + .set_issuer("auth0") + .set_issued_at(std::chrono::system_clock::now()) + .set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{3600}) + .sign(jwt::algorithm::hs256{"secret"}); +``` + ## Contributing If you have an improvement or found a bug feel free to [open an issue](https://github.com/Thalhammer/jwt-cpp/issues/new) or add the change and create a pull request. If you file a bug please make sure to include as much information about your environment (compiler version, etc.) as possible to help reproduce the issue. If you add a new feature please make sure to also include test cases for it. ## Dependencies In order to use jwt-cpp you need the following tools. * libcrypto (openssl or compatible) +* libssl-dev (for the header files) * a compiler supporting at least c++11 * basic stl support @@ -68,9 +79,15 @@ In order to build the test cases you also need * pthread ## Troubleshooting +#### Expired tokens +If you are generating tokens that seem to immediately expire, you are likely not using UTC. Specifically, +if you use `get_time` to get the current time, it likely uses localtime, while this library uses UTC, +which may be why your token is immediately expiring. Please see example above on the right way to use current time. + #### Missing _HMAC amd _EVP_sha256 symbols on Mac There seems to exists a problem with the included openssl library of MacOS. Make sure you link to one provided by brew. See [here](https://github.com/Thalhammer/jwt-cpp/issues/6) for more details. + #### Building on windows fails with syntax errors The header "Windows.h", which is often included in windowsprojects, defines macros for MIN and MAX which screw up std::numeric_limits. See [here](https://github.com/Thalhammer/jwt-cpp/issues/5) for more details. To fix this do one of the following things: |