Steffi
Steffi

Reputation: 1

How to solve "Request had insufficient authentication scopes" Error?

I am trying to copy my Java .jar file into the VM using gcloud compute scp "\Users\jinxjinx\OneDrive\Documents\lib-backend.jar" [email protected]:/home/jinxjinx

However it is giving me an error:

gcloud compute scp "\Users\jinxjinx\OneDrive\Documents\lib-backend.jar" [email protected]:/home/jinxjinx
Did you mean zone [asia-southeast1-b] for instance: [12.123.123.123] (Y/n)?  Y

Error fetching possible zones for instance: [12.123.123.123].
ERROR: (gcloud.compute.scp) Could not fetch resource:
 - Request had insufficient authentication scopes.

When I run gcloud projects get-iam-policy my-project-id

it all seems to be ok: `bindings:

I have also ensured that I have activated my account.

I have also ensured that my Cloud API has access to all Cloud APIs.

Thanks in advance.

Upvotes: 0

Views: 307

Answers (1)

DazWilkin
DazWilkin

Reputation: 40091

I think you're making life more difficult for yourself; use:

  1. Optional: Your gcloud SDK (Google) username
  2. The Google Compute Engine instance's name rather than an IP

See the documentation for gcloud compute scp

I don't know how Windows (Powershell|CMD) handles line breaks so the following command should be on a single line (I've put it on multiple lines for clarity)

gcloud compute scp
  "\Users\jinxjinx\OneDrive\Documents\lib-backend.jar" 
  {INSTANCE}:/home/jinxjinx
  --zone={ZONE}
  --project={PROJECT}

Replace:

  1. {INSTANCE} with the instance name (see below)
  2. {ZONE} with the instance's zone
  3. {PROJECT} with the instance's project

You should be able to describe the instance with the following command:

gcloud compute instance describe {INSTANCE} --zone={ZONE} --project=${PROJECT}

In the gcloud compute scp command, I've omitted your gcloud user account. In your example, you used pcssteffi which may not be correct. You can determine your gcloud user account using:

gcloud config get account

I think your user account is [email protected]

If this is true, you may be able to omit|replace the destination folder (I'm unsure what works) because [email protected] will default to the home directory (/home/jinxjinx).

Upvotes: 0

Related Questions