So i modified the Google Speech API
Example code (didn't work before either) to be on par with their update notice (regarding the deprecation in ClientAuthenticator
) and get the same error as before with no resolution, with the host being speech.googleapis.com/v1beta1/speech:asyncrecognize?key=My_Key
my code is as follows:
public static ManagedChannel createChannel(String host) throws IOException {
FileInputStream filestream = new FileInputStream("/home/admin/creds.json");
GoogleCredentials creds = GoogleCredentials.fromStream(filestream).createScoped(OAUTH2_SCOPES);
ManagedChannel channel = ManagedChannelBuilder.forTarget(host).build();
GreeterGrpc.GreeterStub stub = GreeterGrpc.newStub(channel);
stub = stub.withCallCredentials(MoreCallCredentials.from(creds));
System.out.println(channel.authority()+creds);
filestream.close();
return channel;
}
but it simply returns a
WARNING: RPC failed: Status{code=PERMISSION_DENIED, description=The request cannot be identified with a client project. Please pass a valid API key with the request., cause=null}
any help or advice is welcome, Thanks!
Hey instead of doing this,
please do following:
As your code reinitiate the stub object, you are getting PERMISSION_DENIED.
I hope it helps.