Hello, 

The 'invalid_grant' error is usually noticed when the access token or 
refresh token is invalid or incorrect. To verify this, you can obtain the 
access token being used for the request, then pass that through this 
tokeninfo 
<https://developers.google.com/apis-explorer/#p/oauth2/v2/oauth2.tokeninfo> 
endpoint 
to retrieve the token details. Additionally, could you confirm if you're 
generating the refresh token in every API call? If so, please note that 
there is a limit 
<https://developers.google.com/identity/protocols/OAuth2#expiration> of 50 
refresh tokens per user per account. If you're trying to generate a refresh 
token above the specified limit, they will be invalidated. 

This said, the OAuth2TokenRefresher.php 
<https://github.com/googleads/googleads-php-lib/blob/master/src/Google/AdsApi/Common/Util/OAuth2TokenRefresher.php>
 provides 
functionality to retrieve OAuth2 access tokens and handling refreshing the 
token if it is expired. By default, the client libraries automatically 
refresh expired access tokens. As for your second concern, you will have to 
accept the prompt manually once for every user. Let me know if you have any 
other questions.

Thanks,
Bharani, AdWords API Team

On Monday, October 2, 2017 at 3:06:14 PM UTC-4, sprytar....@gmail.com wrote:
>
> Hi, The previous developer used the function TargetingIdeaService to get 
> new keywords, based on one old one. We have a file with constant 
> settings: adsapi_php.ini.But today we have error 
> Client error: `POST https://www.googleapis.com/oauth2/v4/token` 
> <https://www.googleapis.com/oauth2/v4/token> resulted in a `400 Bad 
> Request` response:
> { "error": "invalid_grant",
> "error_description": "Bad Request" }
> Can I somehow get a long-term token to always get new keywords, do not 
> force the user to give access to the application?
> Thanks
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/2d66d135-c89e-4e84-88de-84184ae13331%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • how to get et... sprytar . developer
    • Re: how ... sprytar . developer
    • Re: how ... 'Bharani Cherukuri (AdWords API Team)' via AdWords API Forum

Reply via email to