Closed GoogleCodeExporter closed 8 years ago
I had the same issue and by chance I tried the GetRefreshToken.php script and
realized that it was returning an URL so I decided to change the script with
what we have in the UseOAuth2.php script and bingo...
So according to my findings you need to set the OAuth2Info with the correct
details, i.e. client_id and client_secret that you get from the google API
console, and then get the url from the OAuth2Handler like :
$OAuth2Handler = $user->GetOAuth2Handler();
$authorizationUrl = $OAuth2Handler->GetAuthorizationUrl($user->GetOAuth2Info(),
NULL, TRUE);
happy coding ;-)
Original comment by jdeara...@auto-planning.fr
on 29 Jul 2013 at 4:26
Thanks! That gets me a step further, but then I get:
OAuth2 authorization successful.
Array
(
[client_id] => *** removed ***
[client_secret] => *** removed ***
)
An error has occurred: Validation failed for [refresh_token] with value []: Eith
er the refresh_token or the access_token is required.
So it says it's worked, I have a refresh token, but then when the script tries
to get the number of campaigns, it's failing.
The details being printed out within $oauth2Info just seem to be the client_id
and client_secret that I originally provided. So I'm not sure what this script
adds, ie the URL gives a refresh token, but where does the access_token come
from?
If anyone could shed any more light on this for me it would be much appreciated!
Original comment by earnafi...@gmail.com
on 30 Jul 2013 at 2:16
The latest major release of the AdWords API client library has many
improvements for the OAuth2 implementation.
Please update to version 4.5.0 or later and try to run the following example:
https://code.google.com/p/google-api-adwords-php/source/browse/examples/AdWords/
Auth/GetRefreshToken.php
For downloads, navigate to:
https://code.google.com/p/google-api-adwords-php/downloads/list
Regards,
- Paul, AdWords API Team.
Original comment by api.pmat...@gmail.com
on 31 Jul 2013 at 4:21
Thanks Paul, that's cracked it!
Original comment by earnafi...@gmail.com
on 31 Jul 2013 at 11:22
[deleted comment]
After running GetRefreshToken.php withthe client_id replaced in the URL, I get:
Your OAuth2 Credentials are incorrect.
Please see the GetRefreshToken.php example.
{
"error" : "invalid_client"
}
Original comment by ger...@azapi.com
on 5 Aug 2013 at 6:02
This bug has been marked as WontFix. If you're seeing an issue, please open a
new bug so it can be handled correctly.
When you file a new bug, please include information on which example you're
running that returns that error. Finally, did you follow the onscreen
instructions of configuring the refresh_token in your auth.ini?
### Please don't respond to this bug, if your problem still exists create a new
bug ###
Regards,
- Paul, AdWords API Team.
Original comment by api.pmat...@gmail.com
on 6 Aug 2013 at 11:37
Original issue reported on code.google.com by
earnafi...@gmail.com
on 29 Jul 2013 at 2:44