I'm trying to access a site that requires a JWT to use it's API.
So I wrote this code in order to generate it:
library(jose)
secret = "ed577ae6d3661fec225c24"
jwt = jwt_encode_hmac(
claim = jwt_claim(
exp = as.numeric(Sys.time() + 300)
),
#secret = hex2raw(secret),
secret = openssl::base64_encode(hex2raw(secret)),
header = list(
id = "643716473b35aa003d3d6")
)
The resulting JWT is:
> jwt
[1] "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImlkIjoiNjQzNzE2NDczYjM1YWEwMDNkM2Q2In0.eyJleHAiOjE2ODEzNTk5MzAsImlhdCI6MTY4MTM1OTYzMH0.qf8frkpXOGhoe3_LJF4Xls6QFlWloG5qQsAf9gSN-rM"
When I paste that JWT into jwt.io, I get Invalid Signature.
I've tried not encoding to 64 and I've also tried charToRaw but got the same Invalid Signature.
Any ideas?
Thanks,