android-play-publisher-api
android-play-publisher-api copied to clipboard
Java - GoogleJsonResponseException: 401 Unauthorized
Hi, I am getting 401 Unauthorized exception while trying to run the java sample code with Service account.
Below is the error stack:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) at com.google.play.developerapi.samples.ListApks.main(ListApks.java:55)
The service account was created and has been marked as the owner of the application. Appreciate any kind of help here.
In google play console, open set Users & permissions menu, set Users with expired access with correct date.
Hi, I am administrator with no expire date but i get always GoogleJsonResponseException: 401 Unauthorized. How can resolve it ? Thank you
Hello, Somebody succed to manage this ?
Thank you
Hello,
I am facing same error (from local machine) as well as from Kubernetes Cluster. Any wayout ?
Thanks.
I have fixed my issue, in the following way:
- Service Account json (key.json) file added as kubectl secret.
- During my pod spins up, I have put the content of the secret as key.json to a path, mounted in the same pod attached to it.
- Then read the key.json from code, it works fine for me.
Please help I'm having the same issue. @arindam-b I don't understand your solution. I'm not working on kubernetes but the prob is same.
@spurgy - you need to ensure when you access the specific resource, you pass proper credentials interns of service account.json file etc which you can generate from cloud console. Before making request call, it needs to be loaded and allows authorization.