The Checks API uses OAuth 2.0 to authorize requests.
The OAuth scope is https://www.googleapis.com/auth/checks
.
Authorize with OAuth 2.0
This quickstart shows you how to authorize requests with a service account using the gcloud CLI.
Set up gcloud CLI
- Install the gcloud CLI.
Login with the gcloud CLI and set a default project:
gcloud auth login
gcloud config set project PROJECT_ID
Create a service account and service account key, and set up Application Default Credentials:
gcloud iam service-accounts create SA_NAME
gcloud iam service-accounts keys create key.json \ --iam-account=SA_NAME@PROJECT_ID.iam.gserviceaccount.com
export GOOGLE_APPLICATION_CREDENTIALS=key.json
Grant API access to your Checks account
API callers must be users of your Checks account and have the appropriate read or write permissions.
Go to the Settings page in the Checks Console and click Manage users.
Invite the service account you created earlier:
SA_NAME@PROJECT_ID.iam.gserviceaccount.com
Locate your account ID
Your Checks account ID is the resource ID for account resource requests.
For example, the accounts.apps.list
method which lists
your apps has the following format:
https://checks.googleapis.com/v1alpha/accounts/ACCOUNT_ID/apps
You can find your account ID on the Settings page under the Account information section in the Checks Console.
Get an access token
gcloud auth application-default print-access-token --scopes=https://www.googleapis.com/auth/checks
Make a request
curl -X GET \
-H "X-Goog-User-Project: PROJECT_ID" \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token --scopes=https://www.googleapis.com/auth/checks)" \
"https://checks.googleapis.com/v1alpha/accounts/ACCOUNT_ID/apps"
What's next?
See our Upload guide to learn how to upload your app for analysis.