"error": "invalid_grant", "error_description": "Invalid email or User ID"

2,260 views
Skip to first unread message

Elena LB

unread,
Feb 8, 2022, 7:22:46 AM2/8/22
to Google Ads API and AdWords API Forum
Good morning,

we are working on the migration to the new Google Ads API and authentication fails.

We are using a Google Cloud service account and its JSON file:

GoogleCredentials Gcredentials = GoogleCredentials.                                
                                fromStream('JSONStream').        
                                createScoped("https://www.googleapis.com/auth/adwords").
                                createDelegated("x...@xxx.com");              
               
                GoogleAdsClient googleAdsClient = GoogleAdsClient.
                                newBuilder().
                                setCredentials(Gcredentials).                                
                                setDeveloperToken("xxxxxxx").
                                setLoginCustomerId(customerId).
                                build();

And this is the error:

java.io.IOException: Error getting access token for service account: 400 Bad Request
{
  "error": "invalid_grant",
  "error_description": "Invalid email or User ID"
}, iss:
Could you please help us with this error?

Thanks!!

Google Ads API Forum Advisor

unread,
Feb 8, 2022, 4:24:11 PM2/8/22
to elena.loza...@telefonica.com, adwor...@googlegroups.com

Hello Elena,

Thanks for reaching out to the Google Ads API support and for providing all details. I understand that you’ve encountered the error, 'invalid_grant'. Usually this error occurs when a token has been expired or revoked. Can you please try regenerating your OAuth2 credentials along with the refresh token and see if this behavior persists?

If the issue persists, could you please provide the complete request and response logs with request ID and request header generated on your end. Please use the  Reply privately to the author option while sharing the details.

Best regards,

Google Logo
Jakeia Sabrina
Google Ads API Team
 

ref:_00D1U1174p._5004Q2W5JWt:ref
Reply all
Reply to author
Forward
0 new messages