"error": "invalid_grant", "error_description": "Bad Request"

915 views
Skip to first unread message

Isabel Gonzalez

unread,
Mar 4, 2024, 7:35:48 PM3/4/24
to Google Ads API and AdWords API Forum
Hola , tengo una aplicacion java con spring y he seguido los pasos para vincularla con la api de google calendar. Hace unos meses funcionó a la primera, pero al cabo del tiempo dejo de funcionar. He vuelto a configurar todo desde 0 y recibo este error 

com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
POST https://oauth2.googleapis.com/token
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:103)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:308)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:324)
at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:547)
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:470)
at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:201)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:880)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:525)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:466)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:576)

Google Ads API Forum Advisor

unread,
Mar 4, 2024, 11:40:17 PM3/4/24
to isagonzal...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

We would like to inform you that this product officially offers support in only English. It would be best to reply in English if you can. If not, we will try to use Google Translate to support you as best as we can.

By reviewing your concern, I understand that you have encountered an invalid_grant error while linking with the Google Calendar API. Could you kindly confirm whether you are using the Google Ads API or the Google Calendar API

If you are using the Google Ads API, then kindly note that the invalid_grant error usually indicates an issue with the refresh token. That said, you’ll need to regenerate credentials and refresh tokens. You may refer here to this guide for the steps on how you can regenerate credentials and refresh tokens. Also, you may also check this sample code for generating user credentials. I would recommend you to kindly refer to the Generate tokens guide as it describes how to generate tokens for more information. You may refer to this document to Fetch a refresh token. Also, follow this guide to know more about the refresh token expiration. 

In order to investigate your issue further, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated to better assit you further.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides in Java to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

​​​​​​​You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rzfjj:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages