# Authentication error using text2-palm

**URL:** <https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063>\
**Category:** Support\
**Created:** [December 4, 2023, 1:35pm UTC](https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063 "2023-12-04T13:35:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fly2moon2](https://avatars.discourse-cdn.com/v4/letter/f/ebca7d/32.png) [@fly2moon2](https://forum.weaviate.io/u/fly2moon2)\
**Post date:** [December 4, 2023, 1:35pm UTC](https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063/1 "2023-12-04T13:35:27Z")

</div>

Dear all,

I’m completely a newbie. I would like to configure to use text2vec-palm (Google PaLM instead of open ai, as given in Weaviate’s example). Refer to my code fragments below, I get error when executing in code fragment 3: batch.add\_data\_object…

My CoLaboratory notebook complains that google authentication is missing, suggesting to provide oauth token etc.

I’m stuck at this point. Grateful if someone can shown you sample code that uses text2vec-palm.

Thanks a lot!

# code segment 1 - client config

import weaviate

auth\_config = weaviate.AuthApiKey(api\_key=“MY\_WEAVIATE\_KEY”)

client = weaviate.Client(  
url=“https://my\_weaviate.weaviate.network”,  
auth\_client\_secret=auth\_config,  
additional\_headers = {

```
    "X-Palm-Api-Key": "MY_GOOGLE_PROJ_API_KEY" # Replace with your API key
}

```

)

# code fragment 2 - class def.

# 

class\_obj = {  
“class”: “Question”,

```
"moduleConfig": {
    "vectorizeClassName": "true",
    "text2vec-palm": {"projectId": "MY_GOOGLE_PROJ_ID }, # projectId is required
    "generative-palm": { "projectId": "MY_GOOGLE_PROJ_ID" } # Ensure the `generative-palm` module is used for generative queries, projectId is required
}

```

}

client.schema.create\_class(class\_obj)

# code fragment 3 - add objects

import requests  
import json  
resp = requests.get(‘MY\_DATA.json’)  
data = json.loads(resp.text) # Load data

client.batch.configure(batch\_size=100) # Configure batch  
with client.batch as batch: # Initialize a batch process  
for i, d in enumerate(data): # Batch import data  
print(f"importing question: {i+1}“)  
properties = {  
“answer”: d[“Answer”],  
“question”: d[“Question”],  
“category”: d[“Category”],  
}  
print(f"property: {properties}”)  
batch.add\_data\_object(  
data\_object=properties,  
class\_name=“Question”  
)

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [December 4, 2023, 9:29pm UTC](https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063/2 "2023-12-04T21:29:09Z")

</div>

Hi!

Can you share here the exact error message you got?

Unfortunately I was not able to get my hands on a palm API yet…

---

<div class="post-metadata">

**Author:** ![fly2moon2](https://avatars.discourse-cdn.com/v4/letter/f/ebca7d/32.png) [@fly2moon2](https://forum.weaviate.io/u/fly2moon2)\
**Post date:** [December 5, 2023, 7:37am UTC](https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063/3 "2023-12-05T07:37:22Z")

</div>

The following error message shows in CoLab notebook when running the batch.add\_data\_object line as in code fragement 3 above. Thanks

{‘error’: [{‘message’: ‘update vector: connection to Google PaLM failed with status: 401 error: 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.](https://developers.google.com/identity/sign-in/web/devconsole-project.)’}]}

---

<div class="post-metadata">

**Author:** ![elynnstl](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/elynnstl/32/1680_2.png) [@elynnstl](https://forum.weaviate.io/u/elynnstl)\
**Post date:** [June 6, 2024, 3:36pm UTC](https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063/4 "2024-06-06T15:36:47Z")

</div>

I’m getting basically the same issue… anyone know how to resolve this?

details = “explorer: get class: vectorize params: vectorize params: vectorize params: vectorize keywords: remote client vectorize: connection to Google failed with status: 401 error: 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.](https://developers.google.com/identity/sign-in/web/devconsole-project.)”

---

<div class="post-metadata">

**Author:** ![Erika\_Cardenas](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/erika_cardenas/32/390_2.png) [@Erika\_Cardenas](https://forum.weaviate.io/u/Erika_Cardenas)\
**Post date:** [June 6, 2024, 9:12pm UTC](https://forum.weaviate.io/t/authentication-error-using-text2-palm/1063/5 "2024-06-06T21:12:42Z")

</div>

Hi @elynnstl,

That error is coming from you not passing in the API correctly. Since you want to use a multi-modal model, you’ll have to use VertexAI.

If you go to your Google Cloud dashboard, click on the `Activate Cloud Shell` button (on the upper right). Once the terminal is connected, write `gcloud auth print-access-token` and it should print out a key. You’ll have to refresh the token every hour and the instructions are [here](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal#vertex-ai).

If you’re using WCD, you will pass it under the `X-Google-Vertex-Api-Key` header. If you deployed it yourself, you can also set `USE_GOOGLE_AUTH=true` and Weaviate will generate the Vertex API key for you.
