File: print-claims.cpp

package info (click to toggle)
scitokens-cpp 0.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 612 kB
  • sloc: cpp: 5,080; makefile: 14
file content (10 lines) | stat: -rw-r--r-- 364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
#include <jwt-cpp/jwt.h>
#include <iostream>

int main(int argc, const char** argv) {
	std::string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9.AbIJTDMFc7yUa5MhvcP03nJPyCPzZtQcGEp-zWfOkEE";
	auto decoded = jwt::decode(token);

	for(auto& e : decoded.get_payload_claims())
		std::cout << e.first << " = " << e.second.to_json() << std::endl;
}