Google ads api authentication in the live server

107 views
Skip to first unread message

sreenu malae

unread,
Mar 26, 2020, 4:05:54 AM3/26/20
to AdWords API and Google Ads API Forum

Currently i'm developing a web-application
where it uses data from google ads

  1. How can i do this OAUTH2 process in server side?
  2. By using google api client library. I can do this OAUTH2 process and i can mention the redirect URI. But in google ads we need refresh token. How can i get that?

Google Ads API Forum Advisor Prod

unread,
Mar 26, 2020, 3:28:06 PM3/26/20
to sreen...@gmail.com, adwor...@googlegroups.com
Hi Sreenu,

Thank you for reaching out to us. I see that you want to set up the OAuth for your client credentials for Web applications. You can do so by following this guide. For your refresh token, you can follow this guide. Let me know if you have further questions.

Thank you,
Bryan, Google Ads API Team

ref:_00D1U1174p._5001UXWmlm:ref

sreenu malae

unread,
Mar 26, 2020, 3:58:51 PM3/26/20
to AdWords API and Google Ads API Forum
Hello Bryan.

Thanks for the reply. 

over here you can see we need to  run this  AuthenticateInWebApplication php file in the terminal
But in the web browser how can I do that.

Let me put my point in a better way
OAUTH2 process is to verify the user 
I can do this in two ways
1) I need to run the above file and get the refresh token and I need to place it in the google_ads_php.ini file where I can't do this in a web application. let me know if there is any way to do so.
2)google api client library This is the other way to do the OAUTH2 verification. Here if its verified. the page will be redirected to specified location. But the problem over here is I cant get the refresh token. whereas google ads need the refresh token in getcampaigns.php

Please help me out.
Thanks 

sreenu malae

unread,
Mar 26, 2020, 4:26:46 PM3/26/20
to AdWords API and Google Ads API Forum
Does refresh token expires after particular period of time?

Google Ads API Forum Advisor Prod

unread,
Mar 27, 2020, 3:11:27 PM3/27/20
to sreen...@gmail.com, adwor...@googlegroups.com
Hi Sreenu,

Thank you for the update and clarification. Could you confirm with me if you're following this guide for PHP Web App Flow? For the question about your refresh token, your refresh token it does not expire. Let me know if you have further questions.
Message has been deleted
Message has been deleted

sreenu malae

unread,
Mar 30, 2020, 6:21:59 AM3/30/20
to AdWords API and Google Ads API Forum
Hey Bray,

Thanks for your reply,

In GetCampaigns.php line number 102 and 103 ==>  $stream =$googleAdsServiceClient->searchStream($customerId, $query);

Do we have any option like search instead of searchStream

I have issues in my server i cant add dynamic library 

So, can you please let me know if there is another way without using searchStream.


Google Ads API Forum Advisor Prod

unread,
Mar 30, 2020, 3:24:17 PM3/30/20
to sreen...@gmail.com, adwor...@googlegroups.com
Hi Sreenu,

Thank you for the update. I see that you have a couple concerns. Below you will find my answers.

1. GetCampaigns.php searchStream issue.
Because this issue looks to be a concern with the client library, could you please post this concern here so that our PHP Client library support team can assist you with this query?

2. Authentication Error.
Could you please verify your credentials by using the OAuth doctor? This tool will help you determine if your OAuth2 credentials are configured correctly, and if they are ready to make API calls. It will also guide you through fixing any OAuth2 problems it detects and verify the corrected configuration. Please give this a try and let us know if you have any issues.

sreenu malae

unread,
Apr 1, 2020, 11:11:04 AM4/1/20
to AdWords API and Google Ads API Forum
Hey Bryan,

In GetCampaigns.php  Instead of using searchstream  can I use search
In getadsgroup  only search was used instead of searchstream. In the same manner I would like to use search in GetCampaigns.php
When i tried in that way, I'm getting Null values.

Google Ads API Forum Advisor Prod

unread,
Apr 1, 2020, 2:24:04 PM4/1/20
to sreen...@gmail.com, adwor...@googlegroups.com
Hi Sreenu,

I see that you've created a new thread for this issue. I'll reply on that thread since it's a new issue.
Reply all
Reply to author
Forward
0 new messages