简体   繁体   中英

How to change Google service account v- Cloud Storage when running from local eclipse

When starting spring boot app that uses cloud storage, I see this

m c.g.c.s.c.DefaultCredentialsProvider.<init> - Default credentials provider for service account lo*ideal@api-project-8##9.iam.gserviceaccount.com

Where is this id coming from, and how can I change it?

In another computer it is admlocal****, how can I change it on this computer too?

Error:

{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "l*eal@api-project-8##429.iam.gserviceaccount.com does not have storage.objects.list access to the Google Cloud Storage bucket.",
    "reason" : "forbidden"
  } ],
  "message" : "l*deal@api-project-8##29.iam.gserviceaccount.com does not have storage.objects.list access to the Google Cloud Storage bucket."
}

What are service accounts ? A service account is a special kind of account used by an application or a virtual machine (VM) instance, not a person. Applications use service accounts to make authorized API calls, authorized as either the service account itself, or as Google Workspace or Cloud Identity users through domain-wide delegation.

For example, a Compute Engine VM can run as a service account, and that account can be given permissions to access the resources it needs. This way the service account is the identity of the service, and the service account's permissions control which resources the service can access.

A service account is identified by its email address, which is unique to the account.

User-managed service accounts

You can create user-managed service accounts in your project using the IAM API, the Cloud Console, or the gcloud command-line tool. You are responsible for managing and securing these accounts.

You can start by checking the application.properties file of your Springboot app. Credentials can be set either by means of,

  • Setting the credentials location, or
spring.cloud.gcp.credentials.location=file:/usr/local/key.json
  • By directly setting the property value of
spring.cloud.gcp.credentials.encoded-key

If the credentials are not specified in the properties file, then you can check the credentials file pointed to by the GOOGLE_APPLICATION_CREDENTIALS environment variable within Eclipse .

In the event that you want to change the credentials associated to your app, you can reconfigure any of the following mentioned above in your own terms. Just make sure to remove any configuration that was previously set to avoid conflicts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM