This repository holds sample code written in Java that demonstrates the Google Cloud Platform.
Some samples have accompanying guides on <cloud.google.com>. See respective README files for details.
-
Clone this repository:
git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
-
Obtain authentication credentials.
Create local credentials by running the following command and following the oauth2 flow (read more about the command here):
gcloud auth application-default login
Or manually set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to point to a service account key JSON file path.Learn more at Setting Up Authentication for Server to Server Production Applications.
Note: Application Default Credentials is able to implicitly find the credentials as long as the application is running on Compute Engine, Kubernetes Engine, App Engine, or Cloud Functions.
- See the Contributing Guide
- See LICENSE