JWT.cc
/**
 * Encode payload with HS256 algorithm
 * 
 * @param map payloadData Payload data
 * @return string Encoded token string
 */
Encode payload with HS256 algorithm

@param map payloadData Payload data
@return string Encoded token string
Encode payload with HS256 algorithm @param map payloadData Payload data @return string Encoded token string
std::string JWTimpl::encode(std::map<std::string, std::string> payloadData)
{
    using namespace jwt::params;
    std::string passcode = this->passcode; 
    jwt::jwt_object obj{
        algorithm("HS256"), 
        payload(std::move(payloadData)), 
        secret(passcode)
    };
    auto enc_str = obj.signature(); 
    return enc_str;
}
std :: string JWTimpl :: encode ( std :: map < std :: string , std :: string > payloadData ) { using namespace jwt :: params ; std :: string passcode = this -> passcode ; jwt :: jwt_object obj { algorithm ( " " ) , payload ( std :: move ( payloadData ) ) , secret ( passcode ) } ; auto enc_str = obj . signature ( ) ; return enc_str ; }
Encode payload with HS256 algorithm
Encode payload with HS256 algorithm
// Secret to use for the algorithm // Create JWT object // Get the encoded string/assertion