{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1405","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1405/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1405/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1405/events","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1405","id":189861840,"number":1405,"title":"Exception: API Key and the authentication credential are from different projects","user":{"login":"gguuss","id":3494394,"avatar_url":"https://avatars.githubusercontent.com/u/3494394?v=3","gravatar_id":"","url":"https://api.github.com/users/gguuss","html_url":"https://github.com/gguuss","followers_url":"https://api.github.com/users/gguuss/followers","following_url":"https://api.github.com/users/gguuss/following{/other_user}","gists_url":"https://api.github.com/users/gguuss/gists{/gist_id}","starred_url":"https://api.github.com/users/gguuss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gguuss/subscriptions","organizations_url":"https://api.github.com/users/gguuss/orgs","repos_url":"https://api.github.com/users/gguuss/repos","events_url":"https://api.github.com/users/gguuss/events{/privacy}","received_events_url":"https://api.github.com/users/gguuss/received_events","type":"User","site_admin":false},"labels":[{"id":175662149,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/labels/auth","name":"auth","color":"bfe5bf","default":false},{"id":486103108,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/labels/blocking%20beta","name":"blocking beta","color":"d93f0b","default":false},{"id":144595203,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/labels/bug","name":"bug","color":"fc2929","default":true},{"id":300154909,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/labels/translate","name":"translate","color":"aaf5ff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-16T22:05:00Z","updated_at":"2016-12-09T23:34:58Z","closed_at":null,"body":"If you have multiple sets of valid credentials configured in your Java environment, the Cloud library will not resolve between the two.\r\n\r\n## Repro steps\r\n\r\n1. Configure client library for API key: `export GOOGLE_API_KEY=SOME_VALID_DEVELOPER_KEY`\r\n2. Configure client library for valid credentials from separate project: `export GOOGLE_APPLICATION_CREDENTIALS=./creds.json`\r\n3. Run java sample, e.g. from github.com/GoogleCloudPlatform/java-docs-samples/translate...\r\n\r\n```\r\nmvn clean compile assembly:single\r\nJAR_FILE=target/translate-1.0-jar-with-dependencies.jar\r\nINPUT=\"A quick brown fox jumped over a lazy dog.\"\r\nSOURCE_LANG=\"en\"\r\nTARGET_LANG=\"fr\"\r\njava -jar $JAR_FILE translate \"$INPUT\" $SOURCE_LANG $TARGET_LANG\r\n```\r\n\r\n## Expected outcome\r\n\r\nClient library warns developer but uses an access token from the service account.\r\n\r\n## Actual outcome\r\nClient library fails, throwing exception and crashing app.\r\n\r\n    Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request\r\n    {\r\n      \"code\" : 400,\r\n      \"errors\" : [ {\r\n        \"domain\" : \"global\",\r\n        \"message\" : \"The API Key and the authentication credential are from different projects.\",\r\n        \"reason\" : \"badRequest\"\r\n      } ],\r\n      \"message\" : \"The API Key and the authentication credential are from different projects.\",\r\n      \"status\" : \"INVALID_ARGUMENT\"\r\n    }"},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/comments/266152646","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1405#issuecomment-266152646","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-java/issues/1405","id":266152646,"user":{"login":"lesv","id":1136014,"avatar_url":"https://avatars.githubusercontent.com/u/1136014?v=3","gravatar_id":"","url":"https://api.github.com/users/lesv","html_url":"https://github.com/lesv","followers_url":"https://api.github.com/users/lesv/followers","following_url":"https://api.github.com/users/lesv/following{/other_user}","gists_url":"https://api.github.com/users/lesv/gists{/gist_id}","starred_url":"https://api.github.com/users/lesv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesv/subscriptions","organizations_url":"https://api.github.com/users/lesv/orgs","repos_url":"https://api.github.com/users/lesv/repos","events_url":"https://api.github.com/users/lesv/events{/privacy}","received_events_url":"https://api.github.com/users/lesv/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T23:34:58Z","updated_at":"2016-12-09T23:34:58Z","body":"GOOGLE_APPLICATION_CREDENTIALS should override `gcloud auth application-default login`"}}
{"actor":{"display_login":"lesv"}}