simbor / google-api-adwords-php

Automatically exported from code.google.com/p/google-api-adwords-php
Apache License 2.0
0 stars 0 forks source link

Oauth getAccessToken() function not working with lib #61

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Which version of the library are you using?
v201101

Which version of PHP are you using?
5.3.3

What steps will reproduce the problem?
when run the oauth example useOAuth.php under sandbox environment. i can get 
output like "Log in to your AdWords account and open the following URL: 
https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%2FMhR...S 
After approving the token enter the verification code here: Invalid auth/bad 
request (got a 400, expected HTTP/1.1 20X or a redirect)". 

What is the expected output? What do you see instead?
i expected message "OAuth authorization successful". instaead i am getting 
"Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect)".

Please provide any additional information below.

OAuth support   enabled
PLAINTEXT support   enabled
RSA-SHA1 support    enabled
HMAC-SHA1 support   enabled
Request engine support  php_streams, curl
source version  $Id: oauth.c 311716 2011-06-01 16:39:36Z datibbaw $
version     1.2 

Original issue reported on code.google.com by chirag.e...@gmail.com on 28 Jun 2011 at 5:44

GoogleCodeExporter commented 8 years ago
There was a known issue with OAuth PECL 1.1, which is fixed in trunk.  Perhaps 
the 1.2 version was affected as well.  Can you please try checking out trunk 
and see if the problem remains?

Original comment by ekoleda+devrel@googlers.com on 28 Jun 2011 at 6:12

GoogleCodeExporter commented 8 years ago
Hi eric,
Thanks for your prompt reply.

i have also tried trunk example 
http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/Oth
er/UseOAuth.php ,but no change in expected output.

Can you please suggest me way so that i can use oauth for my adwords example.

Thanks 

Original comment by chirag.e...@gmail.com on 29 Jun 2011 at 6:15

GoogleCodeExporter commented 8 years ago
My apologies, I had meant for you to check out the entire library from trunk, 
as the OAuth changes were not made in the example.

Original comment by ekoleda+devrel@googlers.com on 29 Jun 2011 at 1:43

GoogleCodeExporter commented 8 years ago
Hi,
I also take entire library from 
http://google-api-adwords-php.googlecode.com/svn/trunk/
But no change in result still had a same output. 

Original comment by chirag.e...@gmail.com on 29 Jun 2011 at 4:24

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,
When i have uninstall oauth(pecl uninstall oauth). and than try to run example 
useOAuth.php(using AndySmithOAuthHandler.php), it is giving me "The token is 
invalid."

Thanks.

Original comment by chirag.e...@gmail.com on 30 Jun 2011 at 9:35

GoogleCodeExporter commented 8 years ago
Have you been able to use the OAuth playground correctly? 
http://googlecodesamples.com/oauth_playground/

Original comment by ekoleda+devrel@googlers.com on 30 Jun 2011 at 1:36

GoogleCodeExporter commented 8 years ago
Hi,
Yes, i am able to use OAuth playground.

Thanks,

Original comment by chirag.e...@gmail.com on 30 Jun 2011 at 4:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

 When i calling callbackurl under RequestOAuthToken(), useOAuth.php is redirecting to callbackurl.on callbackurl i am also getting oauth_verifier. but when i calling UpgradeOAuthToken($verifier) under that i am not getting any of the values for oauthinfo. i think that is the problem for getting error message "The token is invalid.", as there i am not getting oauth_token_secret. Please help me how i can prevent values for oauthinfo.

Thanks

Original comment by chirag.e...@gmail.com on 4 Jul 2011 at 4:44

GoogleCodeExporter commented 8 years ago
Hi Eric,
Can you help me out what i am doing wrong?

Thanks

Original comment by chirag.e...@gmail.com on 5 Jul 2011 at 6:12

GoogleCodeExporter commented 8 years ago
Hi,

The UseOAuth.php example doesn't utilize a callback URL.  Have you modified the 
example?

- Eric

Original comment by ekoleda+devrel@googlers.com on 6 Jul 2011 at 2:57

GoogleCodeExporter commented 8 years ago
Hi Eric,

Yes, i have modified the example.

$user->RequestOAuthToken("http://localhost/adwords/examples/Other/testOAuth.php"
);

// Get the authorization URL for the OAuth token.
$authorizationUrl = $user->GetOAuthAuthorizationUrl();

header("Location:$authorizationUrl");

And under testOAuth.php i have get the value for oauth_verifier.    

    $user = new AdWordsUser();
    $user->LogDefaults();
    $verifier = $_GET['oauth_verifier'];

    $user->UpgradeOAuthToken($verifier);

Please Note that i have also included all required file.

Thanks,
chirag

Original comment by chirag.e...@gmail.com on 6 Jul 2011 at 3:42

GoogleCodeExporter commented 8 years ago
Hi Chirag,

You need to persist the OAuth token and token secret between requests, for 
instance in the PHP session.  The sample web application stores the entire 
AdWordsUser in session:

http://code.google.com/p/google-api-adwords-php/source/browse/apps/sample-webapp
/public/login.php

I'm closing this issue since it is not a problem with the library.

- Eric

Original comment by ekoleda+devrel@googlers.com on 6 Jul 2011 at 3:50