|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-08-21 17:51 UTC] hans at shapeways dot com
Description:
------------
The 1.2.2 oauth provider *adds* url=someurl to an incoming signature base string if its not there before it signs it and then compares the result with what the consumer sent.
The Oauth libraries' auth_client sends a signature base string without the url part, making the request fail with oauth_problem=signature_invalid . According to rfc5849 I think the consumer is right in not adding the url part to the SBS.
I got the provider to accept a signature base string by crafting the oauth consumer by hand using curl and adding a url= part :
$oauth = array(
'oauth_consumer_key' => $consumer_key,
'oauth_nonce' => time(),
'oauth_signature_method' => $signature_method,
'oauth_timestamp' => $timestamp,
'oauth_version' => '1.0',
'oauth_callback' => $callback,
'url' => 'oauth1/request_token');
This works and made me conclude the provider requires the url= part which the libraries Oauth client does not provide.
Test script:
---------------
Here's the relevant library consumer piece :
$oauth_client = new Oauth($consumer_key, $consumer_secret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
$oauth_client->enableDebug();
try {
$info = $oauth_client->getRequestToken("$url, $callback");
The request token provider is from the examples :
$this->provider->setRequestTokenQuery();
$this->provider->checkRequest();
echo $this->provider->generateRequestToken();
Expected result:
----------------
I expect the library Oauth client to be able to talk to the library Oauth provider.
Actual result:
--------------
string(432) "oauth_problem=signature_invalid...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 06:00:02 2025 UTC |
I don't understand this line: $info = $oauth_client->getRequestToken("$url, $callback");Right, mispasted. Sorry for that. While debugging i tried both of these : # $info = $oauth_client->getRequestToken($url, $callback); $info = $oauth_client->getRequestToken("$url?oauth_callback=$callback"); Glad you're looking into this.Issue cause found : a 'nice' mode_rewrite rule adding url=xxxx ! In case anyone else runs into this : add something like $this->oauth->setParam('url', NULL); to the Provider constructor to ignore it so your SBS is correct.