I tried to use the code from IBM Watson GitHub repository I had to change a little bit for some errors I got when pasting it. I tried then to run the code to see it transcript from an audio file to text. But I got error 401 unauthorized. I tried to see solutions but didn't find one. Her is my code,
SpeechToText service = new SpeechToText();
IamOptions options1 = new IamOptions.Builder()
.apiKey("{apikey}")
.build();
service.setIamCredentials(options1);
File audio = new File("C:\\Users\\usern\\Downloads\\audio-file.FLAC");
RecognizeOptions options = new RecognizeOptions.Builder()
.audio(audio)
.contentType(HttpMediaType.AUDIO_FLAC)
.build();
SpeechRecognitionResults transcript = service.recognize(options).execute().getResult();
System.out.println(transcript);