error_description" : "Unauthorized client or scope in request." in Adwords

371 views
Skip to first unread message

Senthil Palaniswami

unread,
Aug 24, 2015, 8:49:40 AM8/24/15
to AdWords API Forum
Team,

I am trying to get the Google AdWords Campaign data by C# Console application with the below settings, using the service account method. But i get the error_description" : "Unauthorized client or scope in request." , it doesn't make sense. Because the same is used in Google Analytics Core V3 API, it works fine. Not sure what is going on, could anyone please direct me here. Thanks a bunch ..

           user.OAuthProvider.Config.OAuth2Mode = OAuth2Flow.SERVICE_ACCOUNT; 

            user.OAuthProvider.Config.OAuth2CertificatePath = @"c:\SCXXXXXXXXXX-fa275b332b6c.p12";

            user.OAuthProvider.Config.OAuth2ServiceAccountEmail = "647795XXXXXXXXXX...@developer.gserviceaccount.com" ;

            user.OAuthProvider.Config.OAuth2PrnEmail = "XXXXXXXX...@gmail.com";

            user.OAuthProvider.Config.OAuth2ClientId = "647797670307-XXXXXXXXadov5.apps.googleusercontent.com";

          user.OAuthProvider.Config.OAuth2Scope = "https://www.googleapis.com/auth/adwords";

            user.OAuthProvider.Config.OAuth2CertificatePassword = "notasecret";



thanks
Senthil

Josh Radcliff (AdWords API Team)

unread,
Aug 24, 2015, 10:55:24 AM8/24/15
to AdWords API Forum
Hi Senthil,

Have you gone through the steps to grant the AdWords scope?


Thanks,
Josh, AdWords API Team


On Monday, August 24, 2015 at 8:49:40 AM UTC-4, Senthil Palaniswami wrote:
Team,

I am trying to get the Google AdWords Campaign data by C# Console application with the below settings, using the service account method. But i get the error_description" : "Unauthorized client or scope in request." , it doesn't make sense. Because the same is used in Google Analytics Core V3 API, it works fine. Not sure what is going on, could anyone please direct me here. Thanks a bunch ..

           user.OAuthProvider.Config.OAuth2Mode = OAuth2Flow.SERVICE_ACCOUNT; 

            user.OAuthProvider.Config.OAuth2CertificatePath = @"c:\SCXXXXXXXXXX-fa275b332b6c.p12";

            user.OAuthProvider.Config.OAuth2ServiceAccountEmail = "647795XXXXXXXXXXXXXXXXXXXXXXXXXXX@developer.gserviceaccount.com" ;

Cory Shaw

unread,
Aug 24, 2015, 11:22:27 AM8/24/15
to AdWords API Forum
Hi Senthil,

We are having the same problem here, and we've used the same setup process previously with an old Service Account. When we had to create a new Service Account recently, the new one wouldn't work, and gave the same error you are seeing.



On Monday, August 24, 2015 at 8:49:40 AM UTC-4, Senthil Palaniswami wrote:
Team,

I am trying to get the Google AdWords Campaign data by C# Console application with the below settings, using the service account method. But i get the error_description" : "Unauthorized client or scope in request." , it doesn't make sense. Because the same is used in Google Analytics Core V3 API, it works fine. Not sure what is going on, could anyone please direct me here. Thanks a bunch ..

           user.OAuthProvider.Config.OAuth2Mode = OAuth2Flow.SERVICE_ACCOUNT; 

            user.OAuthProvider.Config.OAuth2CertificatePath = @"c:\SCXXXXXXXXXX-fa275b332b6c.p12";

            user.OAuthProvider.Config.OAuth2ServiceAccountEmail = "647795XXXXXXXXXXXXXXXXXXXXXXXXXXX@developer.gserviceaccount.com" ;

Senthil Palaniswami

unread,
Aug 24, 2015, 11:38:19 AM8/24/15
to adwordsapia...@google.com, AdWords API Forum
Thanks Josh for your reply .

Yes, I followed all the steps in the below links .. 


--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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 a topic in the Google Groups "AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/gx2nFBGrNxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/bbf79554-380e-4c2c-b92b-2ff8600588e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josh Radcliff (AdWords API Team)

unread,
Aug 24, 2015, 4:05:19 PM8/24/15
to AdWords API Forum, adwordsapia...@google.com
Hi Senthil,

The prn email in your config cannot be a gmail.com user -- it must be a user within your Google Apps Domain. The service account flow allows you to impersonate any user within the domain. You won't be able to use that flow to impersonate a gmail.com user, because if you could, you'd be able to impersonate any Gmail user.

Thanks,
Josh, AdWords API Team

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 a topic in the Google Groups "AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/gx2nFBGrNxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api+unsubscribe@googlegroups.com.

Senthil Palaniswami

unread,
Aug 24, 2015, 4:33:07 PM8/24/15
to AdWords API Forum, adwordsapia...@google.com
thanks Josh.

When i remove that or change the prn email to my service account email, i get the below errrors.

An API exception has occurred. See ApiException and InnerException fields for more details.

{Google.Api.Ads.AdWords.Lib.AdWordsApiException: An API exception has occurred. See ApiException and InnerException fields for more details. ---> System.Web.Services.Protocols.SoapException: [AuthenticationError.NOT_ADS_USER @ ; trigger:'<null>']
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Google.Api.Ads.Common.Lib.AdsSoapClient.MakeApiCall(String methodName, Object[] parameters)
   --- End of inner exception stack trace ---
   at Google.Api.Ads.Common.Lib.AdsSoapClient.MakeApiCall(String methodName, Object[] parameters)
   at Google.Api.Ads.Common.Lib.AdsSoapClient.Invoke(String methodName, Object[] parameters)
   at Google.Api.Ads.AdWords.v201506.CampaignService.get(Selector serviceSelector)
   at VS2010_AdWords.Program.Main(String[] args)

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 a topic in the Google Groups "AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/gx2nFBGrNxM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.

Josh Radcliff (AdWords API Team)

unread,
Aug 24, 2015, 5:28:56 PM8/24/15
to AdWords API Forum, adwordsapia...@google.com
Hi Senthil,

That error means that the prn email you specified does not have access to any AdWords accounts. Please try setting the prn email to a user who has access to the AdWords account you are trying to access via your API request.

Thanks,
Josh, AdWords API Team

Senthil Palaniswami

unread,
Aug 27, 2015, 11:18:07 AM8/27/15
to adwordsapia...@google.com, AdWords API Forum
Thanks Josh.

We don't use Google Apps Account for our work . Is there a way to setup a service account access to get the AdWords data pull ?

We used the service account method with p12 key for Google Analytics Data pull by Core Api V3, it worked awesome. Now we are trying the same method for Adwords API, but no luck as of now . Please assist . 

Cory Shaw

unread,
Aug 27, 2015, 11:21:22 AM8/27/15
to AdWords API Forum, adwordsapia...@google.com
Hey Senthil,

We had the same issues, and fixed it with an offline token. You can read the solution here: https://groups.google.com/forum/#!topic/adwords-api/ncrjBncg2Ds

Fellycia Sutanto

unread,
Jun 15, 2020, 4:44:06 PM6/15/20
to AdWords API and Google Ads API Forum
Hi Senthil,

Im facing the same issue with the service account. Were you able to resolve this?


On Monday, August 24, 2015 at 7:49:40 AM UTC-5, Senthil Palaniswami wrote:
Team,

I am trying to get the Google AdWords Campaign data by C# Console application with the below settings, using the service account method. But i get the error_description" : "Unauthorized client or scope in request." , it doesn't make sense. Because the same is used in Google Analytics Core V3 API, it works fine. Not sure what is going on, could anyone please direct me here. Thanks a bunch ..

           user.OAuthProvider.Config.OAuth2Mode = OAuth2Flow.SERVICE_ACCOUNT; 

            user.OAuthProvider.Config.OAuth2CertificatePath = @"c:\SCXXXXXXXXXX-fa275b332b6c.p12";

            user.OAuthProvider.Config.OAuth2ServiceAccountEmail = "647795XXXXXXXXXXXXXXXXXXXXXXXXXXX@developer.gserviceaccount.com" ;

Google Ads API Forum Advisor Prod

unread,
Jun 16, 2020, 10:52:58 AM6/16/20
to fsut...@beyondfinance.com, adwor...@googlegroups.com
Hi Fellycia,

You should be able to resolve the issue with an offline token like Cory mentioned.

If you still face issues, please create a new thread so we can take a further look.

Regards,
Anthony
Google Ads API Team

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