You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-16Lines changed: 39 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,40 +115,63 @@ Most `google-cloud` libraries require a project ID. There are multiple ways to
115
115
Authentication
116
116
--------------
117
117
118
-
First, ensure that the necessary Google Cloud APIs are enabled for your project. To do this, follow the instructions on the [authentication document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/authentication/readme.md#authentication) shared by all the gcloud language libraries.
to authenticate requests. `google-auth-library-java` supports a wide range of authentication types,
121
+
see the project's [README](https://github.com/google/google-auth-library-java/blob/master/README.md)
122
+
and [javadoc](http://google.github.io/google-auth-library-java/releases/0.6.0/apidocs/) for more
123
+
details.
124
+
125
+
To access Google Cloud services, you first need to ensure that the necessary Google Cloud APIs are
126
+
enabled for your project. To do this, follow the instructions on the
shared by all the Google Cloud language libraries.
119
129
120
130
Next, choose a method for authenticating API requests from within your project:
121
131
122
-
1. When using `google-cloud` libraries from within Compute/App Engine, no additional authentication steps are necessary.
123
-
2. When using `google-cloud` libraries elsewhere, there are three options:
124
-
*[Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts). After downloading that key, you must do one of the following:
125
-
* Define the environment variable GOOGLE_APPLICATION_CREDENTIALS to be the location of the key. For example:
132
+
1. When using `google-cloud` libraries from within Compute/App Engine, no additional authentication
2. When using `google-cloud` libraries elsewhere, there are several options:
138
+
*[Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts).
139
+
After downloading that key, you must do one of the following:
140
+
* Define the environment variable GOOGLE_APPLICATION_CREDENTIALS to be the location of the key.
* Supply the JSON credentials file when building the service options. For example, this Storage object has the necessary permissions to interact with your Google Cloud Storage data:
145
+
* Supply the JSON credentials file when building the service options. For example, this Storage
146
+
object has the necessary permissions to interact with your Google Cloud Storage data:
* If running locally fordevelopment/testing, you can use Google Cloud SDK. Download the SDK if you haven't already, then login using the SDK (`gcloud auth login`incommand line). Be sure to set your project ID as described above.
137
-
* If you already have an OAuth2 access token, you can use it to authenticate (notice that in this case the access token will not be automatically refreshed):
153
+
* If running locally for development/testing, you can use the
154
+
[Google Cloud SDK](https://cloud.google.com/sdk/). Create Application Default Credentials with
155
+
`gcloud auth application-default login`, `google-cloud` will automatically detect such
156
+
credentials.
157
+
* If you already have an OAuth2 access token, you can use it to authenticate (notice that in this
158
+
case the access token will not be automatically refreshed):
.setProjectId("my-project-id") // must match project ID specified on remote machine
104
104
.setHost("http://<hostname of machine>:<port>")
105
-
.setAuthCredentials(AuthCredentials.noAuth())
105
+
.setNoCredentials()
106
106
.build();
107
107
Datastore localDatastore = options.getService();
108
108
```
@@ -209,7 +209,7 @@ endpoint to the hostname of the remote machine, like the example below.
209
209
PubSubOptions options =PubSubOptions.newBuilder()
210
210
.setProjectId("my-project-id") // must match project ID specified on remote machine
0 commit comments