iovzt / oauth-php

Automatically exported from code.google.com/p/oauth-php
MIT License
0 stars 0 forks source link

hello, i've some error on request_token... #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
first, thank you for make a good class, awesome!

i use to that class in my code.

i'll make a OAuth server for my open-api

but, i've a some errors...

that is My errors...

=======================
Fatal error: Uncaught exception 'OAuthException2' with message 'Request failed 
with code 401: OAuth Verification Failed: Verification of signature failed 
(signature base string was 
"HTTP%3A%2F%2F222.106.54.25%2FOAUTH%2FREQUEST_TOKEN&http%3A%2F%2F222.106.54.25%2
Foauth%2Frequest_token&oauth_consumer_key%3D564cdfec6eca867c7a189416f6c1fe1e04c5
98390%26oauth_nonce%3D4c5af3800413b%26oauth_signature_method%3DHMAC-SHA1%26oauth
_timestamp%3D1281028992%26oauth_token%3D%26oauth_version%3D1.0"). with Array ( 
[0] => eef5f522c321971d86bf955286cac616 [1] => [2] => ) ' in 
/usr/local/httpd/htdocs/oauth/library/OAuthRequester.php:117 Stack trace: #0 
/usr/local/httpd/htdocs/oauth/apitest.php(13): OAuthRequester->doRequest(0) #1 
{main} thrown in /usr/local/httpd/htdocs/oauth/library/OAuthRequester.php on 
line 117
=======================

to solve that problem, how do i? @_@

sorry, my pool english xD

have a nice day!

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
1.45, linux (php 5.3.1)

Please provide any additional information below.

Original issue reported on code.google.com by sjh...@gmail.com on 5 Aug 2010 at 8:48

Attachments:

GoogleCodeExporter commented 8 years ago
Ahn, there's no version 1.45, but I'll assume you are using 142, which is the 
latest one.

Your code is correct. Are you using oauth-php in the server too? The problem 
could be there, either a bug or the server does not support HMAC-SHA1 
(unlikely). 

Original comment by brunobg%...@gtempaccount.com on 5 Aug 2010 at 12:55

GoogleCodeExporter commented 8 years ago
hello, thanks you for fast answer!

sorry my mistake..kk current version is 142! got it~

but, i've same errors...check in hash_hmac function on my php.

it is a already exists.

i think, my problem is my server code...(attached)

and sorry my suck english..T_T

have a nice day!! ^^

Original comment by sjh...@gmail.com on 6 Aug 2010 at 1:25

GoogleCodeExporter commented 8 years ago
i'm sovled my problem..

just using a 135 version on same server and client code @_@.

anyway, thank you!

have a nice day~~

Original comment by sjh...@gmail.com on 6 Aug 2010 at 4:13

GoogleCodeExporter commented 8 years ago
hello, i've another problem..i think, it's a my mistake..
but i don't know why.. @_@

in this access_token step.
================
OAuth Verification Failed: Can't verify request, missing oauth_consumer_key or 
oauth_token
================

and, i print debug message.

    [param:protected] => Array
        (
            [oauth_token] => 
            [oauth_signature_method] => HMAC-SHA1
            [oauth_signature] => pI4GXbMBLTNzo9UpY828pWHl5oo%3D
            [oauth_nonce] => 4c5c486e7247d
            [oauth_timestamp] => 1281116270
            [oauth_consumer_key] => b20bc3a54e7a68dbfd2e8e73cca5432f04c5c2f97
            [oauth_version] => 1.0
        )

    [headers:protected] => Array
        (
            [Accept] => */*
            [Authorization] => OAuth realm="", oauth_token="", oauth_signature_method="HMAC-SHA1", oauth_signature="pI4GXbMBLTNzo9UpY828pWHl5oo%3D", oauth_nonce="4c5c486e7247d", oauth_timestamp="1281116270", oauth_consumer_key="b20bc3a54e7a68dbfd2e8e73cca5432f04c5c2f97", oauth_version="1.0"
            [Host] => 222.106.54.25
            [User-Agent] => anyMeta/OAuth 1.0 - ($LastChangedRevision: 134 $)
        )

i already have a authorized oauth_token!

"http://222.106.54.25/oauth/apitest.php?oauth_token=52c82c6a956884aa35d77d2ac7fd
1a7304c5c4832"

what's wrong?? @_@

Original comment by sjh...@gmail.com on 6 Aug 2010 at 9:00

Attachments:

GoogleCodeExporter commented 8 years ago
First: so your code works on 135 but not 142? Please confirm this, as if so 
there may be a bug in 142.

Regarding your problem: your oauth_token is null. You need to pass it as a 
parameter. It's being lost somewhere.

Original comment by brunobg%...@gtempaccount.com on 6 Aug 2010 at 7:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
hello, nice meet you.

I got some problem on v135 library. :(
(I Only use a v135~)

request_token, authorized step is okay.

but i've a error on "access_token" step.

error reason is not in parameter "oauth_token"...

I has a authorized oauth_token..but, it is not in parameter. why??

                if(!$_GET['oauth_token']) {
                     // request_token, authorize redirect code.
                }
        else {
            $access = new OAuthRequester($access_url, "POST");
                        //below line is something wrong?
            $access->setParam("oauth_token", $_GET['oauth_token']);
            $access->setParam("oauth_verifier", $_GET['oauth_verifier']);

            $access_result = $access->doRequest(0);
            $access_response = $access_result['body'];
            echo "access token : " . $access_response;
            exit;
        } //end else

thanks you!

Regards.

Original comment by sjh...@gmail.com on 17 Aug 2010 at 8:10

GoogleCodeExporter commented 8 years ago
Don't use redirection with the 2-legged storage. It does not work. You may try 
the new Session storage, but prefer a database storage if possible.

Original comment by brunobg%...@gtempaccount.com on 31 Aug 2010 at 5:40

GoogleCodeExporter commented 8 years ago
I think, revision 139 broke the signature verification algorithm.

http://code.google.com/p/oauth-php/source/detail?r=139

This change smells a lot for me. Undoing this change on the codebase solves my 
problem of course. Please review this change!

Original comment by szabolcs...@gmail.com on 6 Oct 2010 at 9:46

GoogleCodeExporter commented 8 years ago
Could you please tell me what webserver you are using?

If possible, please try changing line 89:

if (isset($_SERVER['SCRIPT_URI'])) {

to

if (isset($_SERVER['SCRIPT_URI']) and $_SERVER['SCRIPT_URI']) {

and tell me if this works.

Original comment by brunobg%...@gtempaccount.com on 6 Oct 2010 at 8:02

GoogleCodeExporter commented 8 years ago
I have same kind of problem when trying to use my oauth-libraries. My client 
works, when I use this http://term.ie/oauth/example/ test server. And my Server 
works when I use testclient from the same place. When trying to request token I 
get following error message: ExceptionRequest failed with code 401: OAuth 
Verification Failed: Can't verify request, missing oauth_consumer_key or 
oauth_token .

Can you help me somehow? Where to start finding problem?

Original comment by sauli.ru...@gmail.com on 13 Nov 2010 at 2:04

GoogleCodeExporter commented 8 years ago
I ran into the same problem as sjh21a at the top :

=======================
Fatal error: Uncaught exception 'OAuthException2' with message 'Request failed 
with code 401: OAuth Verification Failed: Verification of signature failed 
(signature base string was 
"HTTP%3A%2F%2F222.106.54.25%2FOAUTH%2FREQUEST_TOKEN&http%3A%2F .....

and indeed as szabolcs.heilig stated undoing the change of 139 fixed the 
problem.

[Changing line 89 as advised after did not change anything for me.]

Original comment by jeromesa...@gmail.com on 24 Nov 2010 at 7:23

GoogleCodeExporter commented 8 years ago
Ok, I think the problems here are linked to both line 139 (I reverted it in 
r173) and to the issues 83 (just fixed) and 84 (being fixed). 

Feedback is appreciated: tell me if it's working or not for you now, please.

Original comment by brunobg%...@gtempaccount.com on 24 Nov 2010 at 2:23

GoogleCodeExporter commented 8 years ago
To everybody having this issue: if you can post test examples, I'll run them 
and figure out what is wrong. The tests seem to be working as of r174.

Original comment by brunobg%...@gtempaccount.com on 24 Nov 2010 at 3:15

GoogleCodeExporter commented 8 years ago
In requestRequestToken() within OAuthRequestSigner.php, the request is failing 
with this error: "OAuth Verification Failed: Can't verify request, missing 
oauth_consumer_key or oauth_token"

I do not understand how I can pass an oauth_token through, as at this point in 
the request, one does not exist.  Please help, thanks!  

Original comment by hbli.cou...@gmail.com on 2 Jul 2012 at 4:11

GoogleCodeExporter commented 8 years ago
Hi
You can use 
$server->verifyIfSigned(false) instead of $server->verifyIfSigned() in hello.php
cheers
I found the solution here: 
http://stackoverflow.com/questions/11555138/oauth-api-client-getting-error

Original comment by remithom...@gmail.com on 24 Jan 2013 at 10:09