Below is how I am generating the signed JWT .I have created a service account in Google cloud platform console and using its credentials.
const sig = jwt.sign