Skip to content

Commit 108df92

Browse files
lbergelsonchingor13
authored andcommitted
Add note about NO_GCE_CHECK to Metadata 404 Error (#205)
This makes the workaround to issue #204 much easier to discover.
1 parent cdcf589 commit 108df92

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ public AccessToken refreshAccessToken() throws IOException {
155155
if (statusCode == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
156156
throw new IOException(String.format("Error code %s trying to get security access token from"
157157
+ " Compute Engine metadata for the default service account. This may be because"
158-
+ " the virtual machine instance does not have permission scopes specified.",
159-
statusCode));
158+
+ " the virtual machine instance does not have permission scopes specified."
159+
+ " It is possible to skip checking for Compute Engine metadata by specifying the environment "
160+
+ " variable " + DefaultCredentialsProvider.NO_GCE_CHECK_ENV_VAR + "=true.", statusCode));
160161
}
161162
if (statusCode != HttpStatusCodes.STATUS_CODE_OK) {
162163
throw new IOException(String.format("Unexpected Error code %s trying to get security access"

0 commit comments

Comments
 (0)