Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountering a "Permission denied" error while using an API #356

Open
stan1233 opened this issue Apr 8, 2024 · 2 comments
Open

Encountering a "Permission denied" error while using an API #356

stan1233 opened this issue Apr 8, 2024 · 2 comments
Labels
component:support How to do xyz? status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@stan1233
Copy link

stan1233 commented Apr 8, 2024

Description of the bug:

When encountering a "Permission denied" error while using an API, does it imply that there's an issue with my account? Could you please advise on how to resolve this problem?

curl \
  -H 'Content-Type: application/json' \
  -d '{"contents":[{"parts":[{"text":"Write a story about a magic backpack"}]}]}' \
  -X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyAhTarnL1PaQn_yu_uVf0gia9wUyJx8RSI'
{
  "error": {
    "code": 403,
    "message": "Permission denied: Consumer 'api_key:AIzaSyAhTarnL1PaQn_yu_uVf0gia9wUyJx8RSI' has been suspended.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CONSUMER_SUSPENDED",
        "domain": "googleapis.com",
        "metadata": {
          "service": "generativelanguage.googleapis.com",
          "consumer": "projects/578829824020"
        }
      }
    ]
  }
}

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

@stan1233 stan1233 added the type:bug Something isn't working label Apr 8, 2024
@P1nk-L0rD
Copy link

Same

@singhniraj08 singhniraj08 added status:triaged Issue/PR triaged to the corresponding sub-team component:support How to do xyz? labels Apr 18, 2024
@Namanm1994
Copy link

Namanm1994 commented May 29, 2024

"message": "Permission denied: Consumer 'api_key:AIzaSyAhTarnL1PaQn_yu_uVf0gia9wUyJx8RSI' has been suspended.",
I have 2 comments for you.

  1. Please never post your keys in any online forums, try not to commit them to github either (API keys, API passwords, secret keys etc)
  2. Please read the output, it says your API key has been suspended. Please find out why and how at the docs, customer support or even the stauts of your key at the platform where you generated (Google or Kaggle I suppose)
    Happy Coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:support How to do xyz? status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants