This allows you to take gcloud's application-default login token and turns it into one that can be used by R

  scopes = getOption("googleAuthR.scopes.selected",



The scope you created the access_token with


When authenticating on Google Cloud Platform services, if you are using services that take the cloud scopes you can use gar_gce_auth to generate authentication.

However, for other services that require a user login (such as Google Analytics API), you need a method of authentication where you can use your own email login. You have two options - create a token offline and upload it to the instance, or gcloud allows you to generate your own token online via gcloud auth application-default login && gcloud auth application-default print-access-token

This function will then take the returned access token and put it within R so it can be used as normal with googleAuthR functions.

See also