patterns-ai-core / langchainrb

Build LLM-powered applications in Ruby

Home Page:https://rubydoc.info/gems/langchainrb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vertex AI authentication issues

palladius opened this issue · comments

I'm having issues authenticating with Vertex with APPLICATION_DEFAULT_CREDENTIALS.
I found a simple fix though.

FROM

  @authorizer = ::Google::Auth.get_application_default

TO

  @authorizer = ::Google::Auth.get_application_default(scope: 'https://www.googleapis.com/auth/cloud-platform')

Without fix:

 VertexLLM.authorizer.fetch_access_token
(irb):1:in `<main>': Authorization failed.  Server message: (Signet::AuthorizationError)
{"error":"invalid_scope","error_description":"Invalid OAuth scope or ID token audience provided."}

With fix:

VertexLLM.authorizer.fetch_access_token
=> 
{"access_token"=>
  "ya29xxx",
 "expires_in"=>3599,
 "token_type"=>"Bearer",
 "granted_scopes"=>nil}

@palladius I think we can close this one, right?