5

I am trying to categorize texts by using the google Language API with the provided Java client. The code is in Scala and it looks like this:

val language = LanguageServiceClient.create()
val doc = Document.newBuilder.setGcsContentUri(draftBody).setType(Type.PLAIN_TEXT).build
val request = ClassifyTextRequest.newBuilder.setDocument(doc).build
val response = language.classifyText(request)

The client fails to authorize though, is there a way to authorize with the API key I have created?

Alper t. Turker
  • 34,230
  • 9
  • 83
  • 115
  • What is the system you are working on (local, GAE, GCE) ? what are the credentials that you are using ? When you perform LanguageServiceClient.create() without passing any parameter you are using the system default credential. Check out how they are retrived by the system. Also provide the error message you are getting for more insight. – Pievis Sep 06 '19 at 15:21

0 Answers0