<
7B3E
img src="https://camo.githubusercontent.com/20b6f30c8351c6712d299f70c9e5057fbecb77bcb9bff8a61f55ca42adeeb84e/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f636c6f75642d64657672656c2d6b6f6b6f726f2d7265736f75726365732f6a6176612f6261646765732f6a6176612d646f63732d73616d706c65732e706e67" alt="Kokoro Build Status" data-canonical-src="https://storage.googleapis.com/cloud-devrel-kokoro-resources/java/badges/java-docs-samples.png" style="max-width: 100%;">
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