Error trying to get campaigns using Google Ads Api v1

46 views
Skip to first unread message

Krishna Kishore

unread,
Mar 15, 2019, 3:13:49 PM3/15/19
to AdWords API and Google Ads API Forum


Status: Status{code=UNAUTHENTICATED, description=Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential.

I tried to get the session, using the following code

Credentials credentials =
   
UserCredentials.newBuilder()
       
.setClientId("INSERT_CLIENT_ID")
       
.setClientSecret("INSERT_CLIENT_SECRET")
       
.setRefreshToken("INSERT_REFRESH_TOKEN")
       
.build();
GoogleAdsClient googleAdsClient =
   
GoogleAdsClient.newBuilder()
       
.setCredentials(credentials)
       
.setDeveloperToken("INSERT_DEVELOPER_TOKEN_HERE")
       
.setLoginCustomerId("INSERT_LOGIN_CUSTOMER_ID_HERE") // Manager accounts only.
       
.build();

Am I missing anything?? Should I be giving the access token?? If yes where I can get the access token? 

Krishna Kishore

unread,
Mar 15, 2019, 3:45:10 PM3/15/19
to AdWords API and Google Ads API Forum
I'm trying to migrate from Adwords API to Ads API, so I'm reusing the clientId, Client Secret and refresh token that I've used for Adwords API, as it was clearly mentioned in Ads Api Documentation that I can re-use them.

googleadsapi...@google.com

unread,
Mar 15, 2019, 5:53:51 PM3/15/19
to AdWords API and Google Ads API Forum
Hello Krishna,

Yes, you can use the same credentials that you have used for the AdWords API to run the GetAdGroups.java program. You could refer to this migration guide while migrating from the AdWords API to the Google Ads API. If you are still facing the issue please share the email address of the user that the Oauth credentials are created by and the Client customer Id that is used to make the API call along with the complete error logs. You could use reply privately to the author option while sharing the information requested. 

Regards,
Sai Teja, Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Reply all
Reply to author
Forward
0 new messages