What im looking for is a curl call that will generate token using service account and found
but here we need to provide gcloud default token every time to generate token.
Can anyone please suggest a better way of doing this, like using details I have in service account key file instead of running gcloud commands.
Can anyone please suggest a better way of doing this, like using details I have in service account key file instead of running gcloud commands.
Yes.
The way to do it:
In response you get an access token. It is good for 30-60 minutes. (I can't remember which).
Use any tool you like to create and sign the JWT and POST it to the token endpoint. Here's a nodejs script that does it. Even an Apigee proxy can do it (via GenerateJWT and ServiceCallout), if it has access to the SA .json file.
If you already have gcloud, though, you may be able to do it more simply. There is a way to grant to a user the ability to impersonate a Service Account. If you do that, you can then use gcloud to get the token that represents the service account. gcloud does all the JWT signing and so on.
User | Count |
---|---|
5 | |
2 | |
1 | |
1 | |
1 |