Com.google.aaaal 400 Bad Request {"error": "invalid_grant"} when inserting a row in bigquery

Hi, I am working on an Android application in which I integrated BigQuery . When I insert records into BigQuery tables, I get many exceptions. I am not an expert on this, so it would be great if you guys could help me with this.

1. Error log

  com.google.aaaal: 400 Bad Request { "error" : "invalid_grant" } at com.google.aaaaha(TokenRequest.java:307) at com.google.aabaabf(GoogleCredential.java:384) at com.google.aaaach(Credential.java:489) at com.google.aaaaca(Credential.java:217) at com.google.aacrp(HttpRequest.java:859) at com.google.aabdcc(AbstractGoogleClientRequest.java:469) at com.test.utils.cb(CommonUtility.java:3264) at com.test.services.NetworkChangeIntentService.onHandleIntent(NetworkChangeIntentService.java:72) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.os.HandlerThread.run(HandlerThread.java:61) 

2. Error log

  com.google.aaaal: 400 Bad Request { "error" : "invalid_grant" } at com.google.aaaaha(TokenRequest.java:307) at com.google.aabaabf(GoogleCredential.java:384) at com.google.aaaach(Credential.java:489) at com.google.aaaaca(Credential.java:217) at com.google.aacrp(HttpRequest.java:859) at com.google.aabdcc(AbstractGoogleClientRequest.java:469) at com.test.utils.ka(CommonUtility.java:3156) at com.test.utils.k.doInBackground(CommonUtility.java:3078) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) 
+4
source share
2 answers

From the TokenRequest line with which your application crashes, combined with the knowledge that in HTTP error code 400 means an invalid request, I would say that your problem is that your application is trying to send incorrectly formatted data or sending more / less data than expected.

In addition, the error you return tells you that you have "invalid_grant", so this should mean that the application received a response to the rejection of the server due to the fact that it was not privileged (registered) to do all that he is trying to do is your application, most likely due to an incorrect request error.

Reading a little more about the subject, others seem to have had similar problems.

invalid_grant is trying to get oAuth token from google

Their solution was to change client_id to an email address.

This seems to be a problem when the Google API is a mess.

From what I read, it seems that it will allow you to connect correctly for the first time, and then revoke the token for the session, sending back this error that you are currently receiving.

So, the first step you need to take is to replace client_id with the email address associated with the client ID.

+2
source

Invalid_grat errors usually mean that you either do not send the correct authorization token in the header of your request to the authenticated endpoint, or you do not receive credentials to the endpoint where you should get the token from (in this case, I would say the second option).

0
source

All Articles