Trying to use gemini using google.generativeai but its showing below error message,need help!

Need more understanding of below error message and where to fix it in google cloud,

google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes. [reason: "ACCESS_TOKEN_SCOPE_INSUFFICIENT"
domain: "googleapis.com"
metadata {
key: "service"
value: "generativelanguage.googleapis.com"
}
metadata {
key: "method"
value: "google.ai.generativelanguage.v1beta.ModelService.ListModels"
}
]

3 3 3,393
3 REPLIES 3

Hi @Tech2hard

Welcome and thank you for reaching out to our community.

The error message you are getting indicates permission issues. Please ensure that your account or service account has the needed access requirements for your scopes and revisit your authentication method for your environment.

You can check out these posts as it resembles your use case, they might be helpful.


@catherinwilliam wrote:

Specifically, check the authentication scopes for the method "google.ai.generativelanguage.v1beta.ModelService.ListModels" in the Google Cloud console.


Is there a specific instruction how to do this? I couldn't find the way.

Here is the documentation for that API I think