invalid client type when authenticating with oauth

2,147 views
Skip to first unread message

noam....@pixoneye.com

unread,
Dec 21, 2016, 3:36:12 AM12/21/16
to Google's DoubleClick for Publishers API Forum

I'm trying to connect to DFP with a node js client, which requires me to create a refresh token:


https://github.com/ShinyAds/node-google-dfp


So I went to the developers console, and created an OAuth client ID for a web application. The OAuth consent screen contains my email and product name to be shown to user. Next I downloaded the json file, that contains the following fields: client_id, project_id, auth_uri, token_uri, auth_provider_x509_cert_url and client_secret. 


Then I took the client_id from the json and made the following POST request:


URL: https://accounts.google.com/o/oauth2/device/code

Body: client_id=xxxxx.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/dfp



The response I got from the server is this:

{
 "error": "invalid_client",
 "error_description": "Invalid client type."
}


I carefully checked that the client_id doesn't contain trailing spaces or anything like that. 


Thanks for your help.

Vincent Racaza (DFP API Team)

unread,
Dec 21, 2016, 4:00:18 AM12/21/16
to Google's DoubleClick for Publishers API Forum
Hi,

The error means that you have an invalid OAuth credentials.

There are two types of authentication for the DFP API. It is either you authenticate with a service account or a web application account. For the service account authentication, you may check this document. For the web application type, please check this document. Since you are not using our official DFP API client libraries that we support, what I can only provide are the properties that you need to set. For service account, you only need to set the jsonKeyFilePath (in Java). For web application type, you need to set the clientIdclientSecret and refreshToken (in Java).

For the other fields that are specified in your library's property file, I cannot comment on those as we do not support the library. Please check our documents for service account authentication or for web application account authentication so you can pattern it in your project.

Thanks,
Vincent Racaza, DFP API Team

noam....@pixoneye.com

unread,
Dec 21, 2016, 4:15:05 AM12/21/16
to Google's DoubleClick for Publishers API Forum
Hi Vincent,

I can switch to python if I you will help me. I did follow the instructions in the link below but I got that error I told you:


Regards.

Vincent Racaza (DFP API Team)

unread,
Dec 21, 2016, 4:39:06 AM12/21/16
to Google's DoubleClick for Publishers API Forum
Hi,

Our team will gladly help you on your concerns regarding DFP API.

To get the client id and secret for the web application type, you can follow the link that I provided. Now, since you will be using Python, you need to generate the refresh token by running the Generate Refresh Token example code. Please follow the instructions in the console on running this code. The final output of this code is the refresh token. After those, you need to set them in the googleads.yaml file. You need to set the application_nameclient_idclient_secretrefresh_token and network_code. After that, you are now ready to run one of our API services.

Let me know how it goes after doing these things.

Thanks,
Vincent Racaza, DFP API Team

noam....@pixoneye.com

unread,
Dec 21, 2016, 6:37:21 AM12/21/16
to Google's DoubleClick for Publishers API Forum
Hi,

Thanks for your help, I will try it.

I have one more question: does the refresh token ever expires so that at some point I will need to refresh it manually or programmatically?

Thanks.

Vincent Racaza (DFP API Team)

unread,
Dec 21, 2016, 9:51:55 PM12/21/16
to Google's DoubleClick for Publishers API Forum
Hi

You can check on this documentation on the possible reasons on why a refresh token expires. If it will expire, then you just need to generate it again using the example code that I provided in my previous reply..

Thanks,
Vincent Racaza, DFP API Team

noam....@pixoneye.com

unread,
Dec 28, 2016, 11:08:44 AM12/28/16
to Google's DoubleClick for Publishers API Forum
Hi Vincent,

I have a customer that owns a DFP account. This customer added my account so I can see the campaigns, but I don't have admin priveleges. Could it be the reason why the authentication has failed? Do I need to own a DFP account or be admin to make it work?

Thanks.

Sreelakshmi Sasidharan (DFP API Team)

unread,
Dec 28, 2016, 2:08:36 PM12/28/16
to Google's DoubleClick for Publishers API Forum
Hi, 

Could you please confirm the error that you are facing? Please share you SOAP logs (request/response) and the error message along with the DFP network code. 

It is not necessary to be an admin or own a DFP account to make successful DFP API calls. Your access to the DFP would be based on the user role permissions

Thanks,
Sreelakshmi Sasidharan, DFP  API Team

noam....@pixoneye.com

unread,
Dec 29, 2016, 2:29:12 AM12/29/16
to Google's DoubleClick for Publishers API Forum
Hi,

All I have is this:

Request (POST):
------------------------
Response:
---------------

{
  "error": "invalid_client",
  "error_description": "Invalid client type."
}

Response status is 401.

Thanks.

Sreelakshmi Sasidharan (DFP API Team)

unread,
Dec 29, 2016, 2:04:54 PM12/29/16
to Google's DoubleClick for Publishers API Forum
Hi, 

I see that the URL you have mentioned above is for TV and Limited Input Device applications. As you can see from the allowed scopes section, the scope that you are trying to use is not supported for this URL. If yours is a web server application, please check this guide instead.

From your earlier response, I believe you did change your code to use our python client libraries instead of node js client. Could you please confirm if you are getting the same error after that change? My suggestion is to do the OAuth set up process again and regenerate the refresh token. Please refer to the steps already shared by Vincent.

Additionally, please check the document to make sure that the your request headers have all the required information including your application name.

If you are still facing issues, please write back to me with exact steps that you followed.
Reply all
Reply to author
Forward
0 new messages