json web token sign() function requires keys in certain format. Use the code
https://gist.github.com/ygotthilf/baa...
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
Then use your private key to sign.