Multiple issues running AdWords report example - PHP

15 views
Skip to first unread message

cisc...@gmail.com

unread,
Jul 16, 2015, 5:45:10 PM7/16/15
to adwor...@googlegroups.com
I am trying to run the reporting example (DownloadCriteriaReport), and have been fighting my way through problems:

1) I am generating an access token with:

$server = NULL;
$handler = new SimpleOAuth2Handler($server, $scope);


$credentials = array( 'client_id'  => <my client id>,
                                  'client_secret' =><my client secret>,
                                );
$redirectURL = "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=<CLIENT ID>&redirect_uri=<REDIRECT_URI>&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords&access_type=offline"

// Get the authorization code from the URL
$code = $_GET['code'];
 
 
$token_info = $handler->GetAccessToken($credentials, $code, $redirectURL);

First problem: The token returned does not include a refresh token. I have "access_type=offline" specified.

2) I then turn to the sample "GetRefreshToken", because I know I need that. I had to play with this code to make it work, but
    I did get a refresh token back, which I saved into auth.ini.

3) I then try to run the reporting sample "DownloadCriteriaReport.php", and I get the error that my OAUTH token is invalid. I'm using the same authi.ini (with the new refresh token added, so the error confuses me.

Any suggestions?

thanks,
andy

cisc...@gmail.com

unread,
Jul 16, 2015, 6:03:33 PM7/16/15
to adwor...@googlegroups.com
Ok, cancel this, an older post of mine showed up and gave me the information that I needed to get past 1 and not need 2... and now 3 tells me that my developer token is not approved, so I guess I have to wait for that to happen now.

thanks to Josh.
Reply all
Reply to author
Forward
0 new messages