Hi,
I am trying to get the example to run.
Creating the JWT Object works fine.
The programm does not work any longer, as soon as I add the line "auto enc_str = obj.signature();"
Please help.
My code:
/*C++ JWT
https://github.com/arun11299/cpp-jwt*/
#include "cpp-jwt/include/jwt/jwt.hpp"
// other libraries
#include <iostream>
using namespace std;
int main(int, char**) {
std::cout << "Hello, world!\n";
// create Token
string key = "secret"; //Secret to use for the algorithm
jwt::jwt_object obj{jwt::params::algorithm("HS256"),
jwt::params::payload({{"some", "payload"}}),
jwt::params::secret(key)};
// encode Token
auto enc_str = obj.signature();
// decode
// auto dec_obj = jwt::decode(enc_str, algorithms({"HS256"}), secret(key));
// std::cout << dec_obj.header() << std::endl;
// std::cout << dec_obj.payload() << std::endl;
return 0;
}
Hi, I am trying to get the example to run. Creating the JWT Object works fine. The programm does not work any longer, as soon as I add the line "auto enc_str = obj.signature();" Please help.
My code:
My CMakeLists.txt:
My Output: