googleapis / google-api-python-client

🐍 The official Python client library for Google's discovery based APIs.
https://googleapis.github.io/google-api-python-client/docs/
Apache License 2.0
7.66k stars 2.39k forks source link

Chat API now answer "The API is called without service account credentials" #1590

Closed Pierre-AntoineFB closed 2 years ago

Pierre-AntoineFB commented 2 years ago

Hello,

Since a little bit more than one week, I'm not able to make API call to Google Chat. I receive "The API is called without service account credentials" even if I use a service account.

Environment details

Code example

from googleapiclient.discovery import build
from google.oauth2 import service_account
scope_chat = ['https://www.googleapis.com/auth/chat.bot']
subject = 'xxxxx@domain.com' #this email exist in Workspace
secret = '/tmp/google.json'
creds_chat = service_account.Credentials.from_service_account_file(secret, scopes=scope_chat, subject=subject)
chat = build('chat', 'v1', credentials=creds_chat)

chat.spaces().members().list(parent='spaces/XXXXXXXX').execute()

then I receive the following error message Traceback (most recent call last): File "", line 1, in File "/googleapiclient/_helpers.py", line 131, in positional_wrapper return wrapped(*args, **kwargs) File "/googleapiclient/http.py", line 937, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 403 when requesting https://chat.googleapis.com/v1/spaces/XXXXXX/members?alt=json returned "The API is called without service account credentials. Instructions on how to set this up can be found at https://developers.google.com/hangouts/chat/how-tos/service-accounts". Details: "The API is called without service account credentials. Instructions on how to set this up can be found at https://developers.google.com/hangouts/chat/how-tos/service-accounts">

This script was working until the 28th of October (last run on the 21st was successful). The domain-wide delegation is still present for the Scope, and this service account is able to interact with other scopes like Users or Devices.

Is there any changes or what did I do wrong?

Pierre-Antoine

busunkim96 commented 2 years ago

Hi @Pierre-AntoineFB,

Since the API call stopped working without any notable changes It sounds like there might be an issue in the backend.

Please open an issue on the issue tracker https://developers.google.com/chat/support#bugs for the Google Chat API with the information you've shared here.

Thank you!