no login, how to get google ads api access token and refresh token?

96 views
Skip to first unread message

li li

unread,
Sep 21, 2021, 10:42:20 PM9/21/21
to AdWords API and Google Ads API Forum
I want to use google ads api,for example:I want to publish advertisements in my web application,but I dont't want to login in google,how to get google ads api access token and refresh token?

Google Ads API Forum Advisor

unread,
Sep 22, 2021, 9:37:15 AM9/22/21
to hblsy...@gmail.com, adwor...@googlegroups.com

Hi,

Thanks for reaching out to us.

Could you please elaborate on your question “I want to publish advertisements in my web application,but I dont't want to login in google”?

With regards to your question “how to get google ads api access token and refresh token”, for the access token, you can check out the API call example in the OAuth2 guide for details on how to generate an access token. For the refresh token, you may refer here to this guide for the steps on how you can generate the refresh token. In addition, you may check this guide to make your first API call in Google Ads API.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2OSzV3:ref

li li

unread,
Sep 22, 2021, 10:44:36 PM9/22/21
to AdWords API and Google Ads API Forum
Dear Yasar:
       I'm glad to receive your apply, my question “I want to publish advertisements in my web application,but I don't want to login in google”,I want to explain as bellow:
       we have a web application, our customers login in our web application,then we have a module like publish  advertisements, our customers  publish  advertisements via google ads api to google, but our customers  don't want to login in        google.they can manage their own functions like recharge to the google account or publish advertisements in my web application,all the functions call through google ads api。 I have read the OAuth2 guide and I know All Google Ads API calls must be authorized through OAuth2,I just want to generate refresh and access tokens via api,but we don't want to redirect to google to be authorizated。We have alreay  generated a developer token and clinet id,client secret, Can we  realize the function ?
      
      Looking forward to your reply.
      Thanks

Google Ads API Forum Advisor

unread,
Sep 23, 2021, 11:51:27 PM9/23/21
to hblsy...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for the additional details. I work with Yasar and allow me to assist you as well.

Whether you will be using the desktop or the web app flow, you will still be required to perform steps via the browser for completing the process of generating your refresh token.

This should generally be a one time or rare process to perform. You can also check out this guide for causes on why your refresh token may become invalid, and therefore require you to generate them once more.

There is also the option of using a service account for authentication. However, as per the guide as well it states that :

We strongly recommend using OAuth2 desktop app or web app flow instead of service accounts unless you need a domain-specific feature (for example, impersonation). OAuth2 desktop app and web app flows do require an initial user interaction for granting access to the account, but are much simpler to set up.

I hope this helps.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2OSzV3:ref

li li

unread,
Sep 26, 2021, 4:57:50 AM9/26/21
to AdWords API and Google Ads API Forum
Hi:
  so if want to use google ads api, we must require our customers to  login in google, to generate the authorization code or tokens with using OAuth is the only way ? we can't get  authorization code for tokens through google ads api directly,?
    Thanks!

Google Ads API Forum Advisor

unread,
Sep 27, 2021, 10:46:09 PM9/27/21
to hblsy...@gmail.com, adwor...@googlegroups.com

Hello,

Thank you for getting back to us.

Please see our responses to your questions below:

  •  so if want to use google ads api, we must require our customers to login in google, to generate the authorization code or tokens with using OAuth is the only way ? As mentioned by Peter on the previous response, using the desktop or the web app flow will require you to perform steps via the browser for completing the process of generating your refresh token.
  • we can't get  authorization code for tokens through google ads api directly,? Using Service accounts employ an OAuth2 flow that doesn't require human authorization, using instead, a key file that only your app can access.

Regards,

Google Logo
Mark Kevin Albios
Google Ads API Team
 


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