Google Vertex ai API call

Hi,

Trying to follow these steps to access my Google vertex ai-endpoint from my bubble application: Train and use your own models  |  Vertex AI  |  Google Cloud

I’ve set up an API call which looks like this:

…but I’m not sure how to adhere to the last step in the instructions ”To send your request, choose one of these options: curl. Save the request body in a file called request.json, and execute the following command:”.

If I just run a workflow with the API call above I get a 401 saying ”Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential”. I’ve tried setting up a precedent step where I’m getting a Bearer Token for my associated Google Service Account and I’ve tried using it as ”?key=[bearer token]” in the above API call but I’m getting the same error.

Anyone familiar with accessing a Google API in this way?

Thanks in advance!
Johanna

2 Likes

Hi there I was wondering if you managed to connect in the end? I’m trying to connect also and wondering if you could point me in the direction of a example?

Hello @gustafsson.m.johanna & @timgarrett111 ,

I made it by getting the token from the cloud console → CLOUD SHELL https://console.cloud.google.com/welcome
then you open Cloud Shell

and make this call first in CLOUD SHELL

curl “http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token” \ -H “Metadata-Flavor: Google”

You connect and then you make this call in CLOUD SHELL

curl -X GET
-H “Authorization: Bearer $(gcloud auth application-default print-access-token)”
https://cloudresourcemanager.googleapis.com/v3/projects/PROJECT_ID
Replace PROJECT_ID by your project_ID
Then you get your access_token that you need to use in the Authorization “Bearer ya29…” field to authenticate in your other calls.

Source : S'authentifier pour utiliser REST  |  Authentification  |  Google Cloud

I hope it helps.

1 Like

Better, you can authenticate to your google account then get the token to use.
To make the Oaut connexion you can follow this well made instruction by @mebeingken
Google Calendar API use case - Need help / Plugins - Bubble Forum

And call
https://www.googleapis.com/auth/cloud-platform
instead of contact

here the link for launching the connector
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&response_type=code&scope=https://www.googleapis.com/auth/cloud-platform&client_id=“yourappID”&redirect_uri=“yourURI”

2 Likes

Thanks @expertnocode

I notice the “gcloud auth print-access-token” runs out after 1 hour. how do i set it up to never run out? is that possible.

I much prefer Vertext to open.ai but OPEN.ai is much easier to connect to .

Any help would be much appciated.

1 Like

hey @tim22 did you solve your problem?

I’m trying a similar integration, and facing the same issue…

HI There .

No I did not im still trying. did you manage?

KInd regards

If you’re still searching, I figured it out this morning: Connecting to Vertex AI - Step by step setup