com.google.a.a.a.a。在bigquery中插入行时,l400错误请求{“错误”:“invalid_grant”}

时间:2021-12-09 14:32:13

Hi I am working on an android app in which I have integrated BigQuery. I am getting lots of exceptions when inserting records in BigQuery tables. I am not an expert in this so it would be great if you guys could help me on this.

你好,我正在开发一个android应用程序,我在其中集成了BigQuery。在BigQuery表中插入记录时,会有很多异常。我不是这方面的专家,所以如果你们能在这方面帮助我就太好了。

1. Error log

  com.google.a.a.a.a.l: 400 Bad Request
  {
    "error" : "invalid_grant"
  }
         at com.google.a.a.a.a.h.a(TokenRequest.java:307)
         at com.google.a.a.b.a.a.b.f(GoogleCredential.java:384)
         at com.google.a.a.a.a.c.h(Credential.java:489)
         at com.google.a.a.a.a.c.a(Credential.java:217)
         at com.google.a.a.c.r.p(HttpRequest.java:859)
         at com.google.a.a.b.d.c.c(AbstractGoogleClientRequest.java:469)
         at com.test.utils.c.b(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.a.a.a.a.l: 400 Bad Request
  {
    "error" : "invalid_grant"
  }
         at com.google.a.a.a.a.h.a(TokenRequest.java:307)
         at com.google.a.a.b.a.a.b.f(GoogleCredential.java:384)
         at com.google.a.a.a.a.c.h(Credential.java:489)
         at com.google.a.a.a.a.c.a(Credential.java:217)
         at com.google.a.a.c.r.p(HttpRequest.java:859)
         at com.google.a.a.b.d.c.c(AbstractGoogleClientRequest.java:469)
         at com.test.utils.k.a(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)

2 个解决方案

#1


2  

From the TokenRequest line that your application fails at, coupled with the knowledge that in HTTP, a 400 error code means a malformed request, I would say that your problem is that your application is attempting to send incorrectly formatted data, or is sending more/less data than it is expecting.

从应用程序失败的标记请求行,再加上HTTP中有400个错误代码意味着错误的请求,我认为您的问题是应用程序正在尝试发送不正确的格式化数据,或者正在发送比预期的更多/更少的数据。

Also, the error you are getting back is telling you that you have an 'invalid_grant' so this must mean the application received back a rejection reply from the server, due to not being privileged (logged in) to do whatever it is your application is trying to do, most likely because of the malformed request error.

同时,错误你回来告诉你,你有一个“invalid_grant”这一定意味着应用程序从服务器收到了拒绝回答,由于不是特权(登录)做任何应用程序尝试,最有可能因为畸形的请求的错误。

Reading a bit more on the subject, it appears that others have had similar issues.

再多读一些关于这个话题的文章,似乎其他人也有类似的问题。

invalid_grant trying to get oAuth token from google

invalid_grant试图从谷歌中获取oAuth令牌

Their solution was to change the client_id to the email address.

他们的解决方案是将client_id更改为电子邮件地址。

It appears that this is an issue with Google API 'being a mess.'

看来这是谷歌API“一团糟”的问题。

From what I've read, it appears that it will allow you to connect properly the first time, then invalidate your token for the session, sending back that error that you are getting now.

从我所读到的内容来看,它将允许您第一次正确地连接,然后使您的令牌失效,返回您现在正在获得的错误。

So the first step you need to take is replacing the client_id with the email address that is associated with the Client Id.

因此,您需要采取的第一步是将client_id替换为与客户端Id关联的电子邮件地址。

#2


0  

invalid_grat errors usually mean that you are either not sending the correct authorization token on the header of your request to an authenticated endpoint, or you are failing the credentials to the endpoint where you are supposed to get the token from (in this case I would say the second option).

invalid_grat错误通常意味着你没有发送正确的授权令牌在你请求的头一个经过验证的端点,或者你没有端点的凭证,你应该得到令牌(在这种情况下我想说第二个选项)。

#1


2  

From the TokenRequest line that your application fails at, coupled with the knowledge that in HTTP, a 400 error code means a malformed request, I would say that your problem is that your application is attempting to send incorrectly formatted data, or is sending more/less data than it is expecting.

从应用程序失败的标记请求行,再加上HTTP中有400个错误代码意味着错误的请求,我认为您的问题是应用程序正在尝试发送不正确的格式化数据,或者正在发送比预期的更多/更少的数据。

Also, the error you are getting back is telling you that you have an 'invalid_grant' so this must mean the application received back a rejection reply from the server, due to not being privileged (logged in) to do whatever it is your application is trying to do, most likely because of the malformed request error.

同时,错误你回来告诉你,你有一个“invalid_grant”这一定意味着应用程序从服务器收到了拒绝回答,由于不是特权(登录)做任何应用程序尝试,最有可能因为畸形的请求的错误。

Reading a bit more on the subject, it appears that others have had similar issues.

再多读一些关于这个话题的文章,似乎其他人也有类似的问题。

invalid_grant trying to get oAuth token from google

invalid_grant试图从谷歌中获取oAuth令牌

Their solution was to change the client_id to the email address.

他们的解决方案是将client_id更改为电子邮件地址。

It appears that this is an issue with Google API 'being a mess.'

看来这是谷歌API“一团糟”的问题。

From what I've read, it appears that it will allow you to connect properly the first time, then invalidate your token for the session, sending back that error that you are getting now.

从我所读到的内容来看,它将允许您第一次正确地连接,然后使您的令牌失效,返回您现在正在获得的错误。

So the first step you need to take is replacing the client_id with the email address that is associated with the Client Id.

因此,您需要采取的第一步是将client_id替换为与客户端Id关联的电子邮件地址。

#2


0  

invalid_grat errors usually mean that you are either not sending the correct authorization token on the header of your request to an authenticated endpoint, or you are failing the credentials to the endpoint where you are supposed to get the token from (in this case I would say the second option).

invalid_grat错误通常意味着你没有发送正确的授权令牌在你请求的头一个经过验证的端点,或者你没有端点的凭证,你应该得到令牌(在这种情况下我想说第二个选项)。