GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Exception: API Key and the authentication credential are from different projects · Issue #1405 · googleapis/google-cloud-java

Exception: API Key and the authentication credential are from different projects #1405

New issue
Copy link
New issue
Copy link
Closed
Closed
Exception: API Key and the authentication credential are from different projects#1405
Copy link
Assignees
tcoffee-google
Labels
api: translationIssues related to the Cloud Translation API API.authtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Milestone
Translate GA

Description

@gguuss
gguuss
opened on Nov 16, 2016
Issue body actions

If you have multiple sets of valid credentials configured in your Java environment, the Cloud library will not resolve between the two.

Repro steps

  1. Configure client library for API key: export GOOGLE_API_KEY=SOME_VALID_DEVELOPER_KEY
  2. Configure client library for valid credentials from separate project: export GOOGLE_APPLICATION_CREDENTIALS=./creds.json
  3. Run java sample, e.g. from github.com/GoogleCloudPlatform/java-docs-samples/translate...
mvn clean compile assembly:single
JAR_FILE=target/translate-1.0-jar-with-dependencies.jar
INPUT="A quick brown fox jumped over a lazy dog."
SOURCE_LANG="en"
TARGET_LANG="fr"
java -jar $JAR_FILE translate "$INPUT" $SOURCE_LANG $TARGET_LANG

Expected outcome

Client library warns developer but uses an access token from the service account.

Actual outcome

Client library fails, throwing exception and crashing app.

Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "The API Key and the authentication credential are from different projects.",
    "reason" : "badRequest"
  } ],
  "message" : "The API Key and the authentication credential are from different projects.",
  "status" : "INVALID_ARGUMENT"
}

Activity

Next
  1. omaray
    added
    auth
    api: translationIssues related to the Cloud Translation API API.
    triaged
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Nov 21, 2016
  2. garrettjonesgoogle commented on Dec 9, 2016

    @garrettjonesgoogle
    garrettjonesgoogle
    on Dec 9, 2016
    Contributor
    More actions

    We are seeing this in the AppVeyor integration test - looks like an important issue to address.

  3. garrettjonesgoogle
    added
    blocking beta
    and removed
    triaged for beta
    on Dec 9, 2016
  4. lesv commented on Dec 9, 2016

    @lesv
    lesv
    on Dec 9, 2016
    Contributor
    More actions

    GOOGLE_APPLICATION_CREDENTIALS should override gcloud auth application-default login

  5. gguuss commented on Dec 10, 2016

    @gguuss
    gguuss
    on Dec 10, 2016
    ContributorAuthor
    More actions

    @lesv This is happening when you are using the GOOGLE_API_KEY environment variable alongside the GOOGLE_APPLICATION_CREDENTIALS variable. I am not sure whether the default application credentials are affecting the conflict.

  6. danoscarmike
    added
    bug/security
    on Feb 7, 2017
  7. danoscarmike
    removed
    bug/security
    on Feb 21, 2017
  8. lesv
    added
    blocking GA
    triaged for GA
    and removed
    blocking GA
    on Feb 23, 2017
  9. lesv commented on Feb 23, 2017

    @lesv
    lesv
    on Feb 23, 2017
    Contributor
    More actions

    It doesn't sound like this will block GA for Storage, Logging, PubSub, Datastore, or BigQuery

  10. 16 remaining items

  11. tcoffee-google
    added a commit that references this issue on Jun 22, 2017

    WIP: override API key with service account credentials (#2151)

    313a16c
  12. tcoffee-google commented on Jun 22, 2017

    @tcoffee-google
    tcoffee-google
    on Jun 22, 2017
    Contributor
    More actions

    Fixed by #2151.

  13. tcoffee-google
    closed this as completedon Jun 22, 2017
  14. theacodes
    unassigned
    tcoffee-google
    on Sep 28, 2018
  15. JustinBeckwith
    assigned
    tcoffee-google
    on Feb 1, 2021
  16. github-actions
    added a commit that references this issue on Jun 29, 2022

    chore: update dependencies for regapic (googleapis#1467) (googleapis#…

    4be474f
  17. chingor13
    added a commit that references this issue on Jan 6, 2026

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    7a5fdf2
  18. chingor13
    added a commit that references this issue on Feb 24, 2026

    chore: Add auth team as admin. (#1405)

    dde6876
  19. chingor13
    added a commit that references this issue on Mar 12, 2026

    chore: Add auth team as admin. (#1405)

    b304a94
  20. suztomo
    added a commit that references this issue on Mar 23, 2026

    chore(main): release 2.14.3-SNAPSHOT (googleapis#1405)

    555de9e
  21. suztomo
    added a commit that references this issue on Mar 30, 2026

    chore(main): release 0.127.18 (#1405)

    939ca7b
  22. lqiu96
    added a commit that references this issue on Apr 1, 2026

    chore(main): release 0.127.18 (#1405)

    6e1499f
  23. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    chore(java): pom generation to look at root versions.txt (#1706) (#1405)

    9c91a38

    chore(java): pom generation to look at root versions.txt (#1706) (#1405)

    7a48e0a
  24. benjaminp
    added a commit that references this issue on Jul 13, 2026

    samples: Add examples for making requests in a salted row key scenario (

    e6529f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tcoffee-google
    tcoffee-google

Labels

api: translationIssues related to the Cloud Translation API API.authtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    • Translate GA

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.