Questions tagged [service-accounts]

The Google OAuth 2.0 endpoint supports server-to-server interactions such as those between a web application and Google Cloud Storage.

A service account is used when you want to access your own data and not data owned by other users. In this instance there is no reason to use OAuth2 and prompt a user to give you access to there information, its your information you already have access.

For this scenario you need a service account, which is an account that belongs to your application instead of to an individual end user. For example, if you use the Google Prediction API to act on behalf of your application without accessing any user data, your application uses its service-account credentials to prove its own identity, and no end user is involved.

A service account's credentials include a generated email address that is unique, a client ID, and at least one public/private key pair. You obtain these credentials in the Google Developers Console, or if your application uses Google App Engine, a service account is set up automatically. You use the client ID and one private key to create a signed JWT and construct an access-token request in the appropriate format.

1492 questions
11
votes
5 answers

Using Google Cloud Source Repositories with service account

Is it possible to access a Google Cloud Source Repository in an automated way, i.e. from a GCE instance using a service account? The only authentication method I am seeing in the docs is to use the gcloud auth login command, which will authenticate…
10
votes
2 answers

Can GKE Workload Identity be used to access Google Sheets?

I'm currently using GKE Workload Identity to access Google Cloud Platform resources from within GKE. This works very well for Google Cloud Storage and other platform resources. However, I encounter an issue with "insufficient authentication scopes"…
10
votes
2 answers

Using firebase-admin. What are service account credentials used for?

I'm building a cloud function to get some documents and generate an HTML response. And right now what I have is: myFunction.js import * as admin from 'firebase-admin'; import serviceAccount from './someServiceAccountKey.json'; // OPTION #1 …
10
votes
8 answers

PermissionDenied: 403 IAM permission 'dialogflow.intents.list'

I'm trying to get the list of the intents in my Dialogflow agent using Dialogflow's V2 APIs but have been getting the following error: PermissionDenied: 403 IAM permission 'dialogflow.intents.list' on 'projects/xxxx/agent' denied. I adopted the…
10
votes
2 answers

Google sheets API v4 Create sheet and invite users

I am using a service account authentication to create a google sheet using the Google Sheets API. I want to create a spreadsheet and somehow allow my team to open it. $private_key = file_get_contents($rootDir .…
10
votes
4 answers

Loading Service account Json key file

Google has recently started to give us a Json key file for service account instead of the P12 key file. I have been trying to get this there isn't a lot of information out there and what info I have seen says this should work. string[] scopes =…
9
votes
3 answers

java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J

I'm getting this "java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J" error while using ServiceCredentials.fromStream() method. Anyone here faced this and know a fix? TIA
samuel vishal
  • 135
  • 1
  • 6
9
votes
1 answer

Can I use gcloud activate-service-account with impersonation (not static keys)?

gcloud has a --impersonate-service-account flag gsutil has a -i flag But I want to configure impersonation once in my current session and then know that all future commands are using that service account. So what I want is to gcloud…
9
votes
2 answers

How to validate in-app-purchase Android server side Java?

I followed this tutorial: https://medium.com/@infinitesimal_/doing-android-purchase-validation-api-v3-in-java-5c46fc837368 But I can not make it work! All I can get is this: { "code" : 401, "errors" : [ { "domain" : "androidpublisher", …
9
votes
2 answers

Google Service Account Authentication with Json file

I have been following the Oauth2 Service account documentation on Googles website. I have also been picking apart Googles .net client libray trying to get this to work. I have reached the Computing the signature stage. The privacy key from Google…
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
9
votes
2 answers

Use GAE Service Account JSON key

I have an application in GAE and I'm using a service account to call some google services. When I created a service account in the dashboard, a JSON key was provided to me. The content of the json is something like this: { "private_key_id":…
Luiz Guilherme
  • 1,601
  • 21
  • 37
8
votes
3 answers

Application Default Credentials in Google Cloud Build

Within my code, I am attempting to gather the Application Default Credentials from the associated service account in Cloud Build: from google.auth import default credentials, project_id = default() This works fine in my local space because I have…
8
votes
5 answers

Programmatically get current Service Account on GCP

Is there a way to programmatically access the email of the currently used Service Account on a GCP instance when no GOOGLE_APPLICATION_CREDENTIALS is set? (ie. when using the default Service Account) I've looked through the GCP documentation, but…
8
votes
1 answer

Quota exceeded for quota metric 'Queries' and limit 'Queries per minute per user' of service 'gmail.googleapis.com'

Our application makes use of a service account that has been authorized for the entire domain by the admin. With this service account our application accesses the domain user's emails with Gmail APIs like GetMessage. All of a sudden, starting this…
Urjit
  • 375
  • 1
  • 3
  • 12
8
votes
1 answer

Can I get authorization for Youtube's Reporting API from a non UI application?

I want to run an application (on AWS Lambda) periodically that fetches reports using Youtube's reporting API and stores the reports in a database. I'm the owner of the Youtube channel. However, I'm facing issues setting up the authorization. The…