0

I'm using Google earthengine to run GIS computations. recently Google added projects to manages the created assets which means that I need to use the Google cloud API to find back my projet name.

I use a service account to connect to the API but for I don't manage to get access to my project list. I'm sure that I've add the "https://www.googleapis.com/auth/cloudplatformprojects.readonly" scope to my account though.

Is there a way for me to check using the API the list of my current scopes ?

import ee 

ee.Iniitialize() 

# that's the credential I would like to test 
# it's a ServiceAccountCredential like any other Google API (I use it to connect to drive as well)
cred = ee.Credentials()

# something like 
for scope in cred.scopes(): 
    print(scope)
Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47
  • which api are you connecting to exactly can i get a documentation link that you are following for it? – Linda Lawton - DaImTo Jul 18 '22 at 14:01
  • I'm trying to complete the following workflow: https://stackoverflow.com/questions/58366396/google-cloud-platform-list-available-projects-using-api and it's sytematically refused because of scope issues – Pierrick Rambaud Jul 18 '22 at 14:06

1 Answers1

0

You can lookup access and identity tokens from Google's OAuth service tokeninfo method:

  • https://www.googleapis.com/oauth2/v1/tokeninfo?access_token={access_token}
  • https://www.googleapis.com/oauth2/v1/tokeninfo?id_token={id_token}

And there's a Google CLI "OAuth tool" oauth2l that you find useful too.

It includes (among other things) an oauth2l info method

DazWilkin
  • 32,823
  • 5
  • 47
  • 88