Looking at this question I can see there is a way to generate jwt token signed by service account using google auth library
def generate_jwt():
payload = {"iat": iat, "exp": exp, "iss": iss, "aud": aud, "sub": iss, "email": iss, "company": company}
signer = google.auth.crypt.RSASigner.from_service_account_file(sa_keyfile)
jwt = google.auth.jwt.encode(signer, payload)
return jwt
- How do I achieve this with nodejs?
- In the Security section of .yaml file what is the value I need to use for x-google-issuer and x-google-jwks_uri, and please explain in detail what these values are for?
x-google-issuer: "mygserviceaccount"
x-google-jwks_uri: "mygserviceaccount.com"
if for example I generated jwt using service account email: resource-access@xyz.iam.gserviceaccount.com then x-google-issuer:"resource-access@xyz.iam.gserviceaccount.com" and x-google-jwks_uri:"https://www.googleapis.com/service_accounts/v1/metadata/x509/resource-access@xyz.iam.gserviceaccount.com" is this accurate?