googlesamples/assistant-sdk-python

Service account credentials does not work with Google Assistant API

qo4on opened this issue · 4 comments

qo4on commented

When I use other apis like drive or sheets this code works:

SCOPES = ["https://www.googleapis.com/auth/assistant-sdk-prototype"]
credentials = service_account.Credentials.from_service_account_file(
              service_json_fp, scopes=SCOPES)

drive_api = build('drive', 'v3', credentials=credentials)

But when I try this:

assist_api = build('assistant', 'v1', credentials=credentials)

It returns an error. How can I run Google Assistant API?

The Assistant API is not v1. The current version is v1alpha2. Additionally, I don't know that a service account would work at all as the API is geared towards personal accounts.

qo4on commented

Thanks for your help! Are you sure it's impossible? It would be more convenient than clicking on different pages to authorize. Moreover I have a Google console screenshot which allows that:
image

I tried these with no luck:

assist_api = build('assistant', 'v1alpha2', credentials=credentials)
HttpError: <HttpError 502 when requesting https://assistant.googleapis.com/$discovery/rest?version=v1alpha2 returned "Bad Gateway">

assist_api = build('embeddedassistant', 'v1alpha2', credentials=credentials)
HttpError: <HttpError 403 when requesting https://embeddedassistant.googleapis.com/$discovery/rest?version=v1alpha2 returned "The request is missing a valid API key.">

This api key works perfectly with drive and sheets.

The Assistant API is meant to be run by individual users, not a server.

qo4on commented

Ok, thanks!