google ads api Invalid_grant

1,401 views
Skip to first unread message

Muhammad Kaleem

unread,
Dec 15, 2022, 5:34:28 AM12/15/22
to Google Ads API and AdWords API Forum
hi . i am using firbebase with Oauth with the following scopes
while i am calling the google ads api with the resfresh token given by firebase i am having a error-->  Error: 16 UNAUTHENTICATED: Failed to retrieve auth metadata with error: invalid_grant
but when i use oauthAccessToken   it's working fine . so i want to know the expire time to  oauthAccessToken  or  how can i refresh these token so user don;'t have to login again and again .
thanks 

Lambert Beekhuis

unread,
Dec 15, 2022, 6:18:04 AM12/15/22
to Google Ads API and AdWords API Forum
An accessToken is usually valid for 1 hour. After that you must refresh indeed.  If you follow the examples of Google Ads, is always retrieves a new Access Token

Google Ads API Forum Advisor

unread,
Dec 15, 2022, 9:46:35 AM12/15/22
to lambert....@gmail.com, adwor...@googlegroups.com

Hi All,


Thanks for reaching out to the Google Ads API team. I hope you are doing well today.
 

The "invalid_grant ” error usually indicates an issue with the refresh token. That said, you will 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, I agree on what @Lambert said about validity of refresh token.
 

Furthermore, you may check this document to read more information about refresh token expiration.


Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2h3KMj:ref
Reply all
Reply to author
Forward
Message has been deleted
0 new messages