Google Cloud TTS API call fails at st.secret

I have tried replacing “\n” with “\n”, still not wroking…

google_credentials = json.loads(st.secrets['GOOGLE_APPLICATION_CREDENTIALS'])
creds = Credentials.from_service_account_info(google_credentials)
client = texttospeech.TextToSpeechClient(credentials=creds)

json.decoder.JSONDecodeError: Invalid control character at: line 1 column 168 (char 167)

In secret like:

GOOGLE_APPLICATION_CREDENTIALS = """
{
  "type": "service_account",
  "project_id": "your_project_id",
  ...
}
"""

See an example here how to deal with google cloud secrets:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.