Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

HTTP CONNECTION ERROR VERTEX AI

I am trying to connect via HTTP request to Google Vertex AI and can successfully connect for a while. However, after a few hours (more than 12 hours), the following error appears:

{ "error": { "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "CREDENTIALS_MISSING", "domain": "googleapis.com", "metadata": { "method": "google.cloud.aiplatform.v1.PredictionService.GenerateContent", "service": "aiplatform.googleapis.com" } } ] } }

oauth { "error": "invalid_grant", "error_description": "reauth related error (invalid_rapt)", "error_uri": "https://support.google.com/a/answer/9368756", "error_subtype": "invalid_rapt" } oauth@access_token

The method I am using involves creating credentials within the console. I select the Vertex AI API and create credentials with the following characteristics:

deriklfs_0-1724235198680.png

Then, I go to OAuth Playground: https://developers.google.com/oauthplayground/

I select everything that is listed under Vertex AI API.

deriklfs_1-1724235222827.png

 

I choose the following items in the settings:

deriklfs_2-1724235243305.png

 

  • I input the OAuth Client ID and OAuth Client Secret.
  • I click on "Exchange authorization code for tokens."
  • I save the Refresh Token and the Access Token.

 

Within the platform where I will make the HTTP request, I perform the following actions:

0 2 1,247
2 REPLIES 2

The token might expire. You probably want to try other authconfig type, like service account.

 

 

 

Hi @deriklfs,

I agree with @fengwan. Tokens are short-lived. With this, you may need to refresh your token or generate a token. You may consider running $gcloud auth print-access-token using the gcloud CLI. Once done, use this token in your Authorization HTTP header (Authorization: Bearer {TOKEN}).

Hope this helps.

Top Labels in this Space