spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

VertexAIGeminiChat unable to connect to GCP/VertexAI when using credentials.json file

Open Mustahsan1 opened this issue 1 year ago • 1 comments
trafficstars

I am trying to use VertexAIGeminiChat module in my spring boot app, but when I use a service account json file in credentialsUri, I get this error:

UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project

Mustahsan1 avatar Apr 25 '24 14:04 Mustahsan1

Could you please add to the application.properties (or adjust for YAML): "spring.ai.vertex.ai.gemini.transport=rest"

For the ServiceAccount, just to check, are the following IAM roles specified:

  • Vertex AI User (roles/vertexai.user): Allows the service account to use Vertex AI features
  • Service Account User (roles/iam.serviceAccountUser): Lets the service account act as itself

ddobrin avatar Apr 26 '24 18:04 ddobrin