mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
* some manual fixes to obtain * fairly close enough * whitespace fixes * add comment * adding clang format + applied * add editorconfig (supported natively by github web editor) * apply linting to project * clean up CI workflows * zap vcpkg folder actual one is here https://github.com/microsoft/vcpkg/tree/master/ports/jwt-cpp * adding a logo * thin the lines in the pluses * use logo + more links to spec and examples * Create lint.yml * apply linting
18 lines
667 B
C++
18 lines
667 B
C++
#include "jwt-cpp/jwt.h"
|
|
#include <chrono>
|
|
#include <iostream>
|
|
|
|
int main() {
|
|
|
|
std::string token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9."
|
|
"eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE2MTAwMjMxNzcsImV4cCI6MTY0MTU1OTE3NywiYXVkIjoid3"
|
|
"d3LmV4YW1wbGUuY29tIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSIsIkdpdmVuTmFtZSI6IkpvaG5ueSIsIlN1cm5h"
|
|
"bWUiOiJSb2NrZXQiLCJFbWFpbCI6Impyb2NrZXRAZXhhbXBsZS5jb20iLCJSb2xlIjpbIk1hbmFnZXIiLCJQcm9qZWN0IE"
|
|
"FkbWluaXN0cmF0b3IiXX0.5EOfHnBmpdPvRHAuVDttgJQvbFuGEF7fC4uBSXAGg6c";
|
|
|
|
auto decoded = jwt::decode(token);
|
|
|
|
for (auto& e : decoded.get_payload_claims())
|
|
std::cout << e.first << " = " << e.second << std::endl;
|
|
}
|