I'm trying to configure automation in my automation tool (called Tines), that will query the GCP IAM Recommender API and get recommendations for all my GCP projects.
So naturally two API services are involved here:
- cloudresourcemanager.googleapis.com (to list the GCP projects)
- recommender.googleapis.com (to get the recommendations)
For this purpose, I have created a service account with the appropriate roles. I also have a JSON key file for the service account. I'm using PyJWT to generate signed JWT tokens, which work absolutely fine.
I'm facing two problems.
Problem 1: While creating the JWT tokens, when I try to set the expiration time to more than 1 hour, the authentication fails. Any idea how to increase the validity of the JWT token to say a week?
Problem 2: I have to create two JWT tokens for the two API services involved. The more services that get involved, the more tokens that are needed. It's become too hectic. Is there a global API endpoint that I can use for scoping (something like global.googleapis.com)? If yes, then I'd need to create only one JWT token with the 'aud' parameter from my JWT payload set to that global endpoint.
Please advise. Much thanks in advance.