For authentication Cloud Speech-To-Text client in PHP application I use the following:
$credentials = 'C:\cred.json';
$client=new SpeechClient(['credentials'=>json_decode(file_get_contents($credentials), true)]);
For some reasons I receive error:
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error:
POST https://oauth2.googleapis.com/token
resulted in a400 Bad Request
response: {"error":"invalid_scope","error_description":"Invalid OAuth scope or ID token audience provided."}
The above method of authentication works perfectly in Text-To-Speech API.
$credentials = 'C:\cred.json';
$client = new TextToSpeechClient(['credentials' => json_decode(file_get_contents($credentials), true)]);
What is wrong/missing?