Hi, I'm trying to get twolegged OAuth to work against my OAuth server. My
first confusion is that in twoleggedtest.php, the url being accessed is
the 'request_token' endpoint:
$key = 'key'; // fill with your public key
$secret = 'secret'; // fill with your secret key
$url = "http://term.ie/oauth/example/request_token.php"; // fill with the
url for the oauth service
Is that correct? Can it not be set directly to
a '$server->verifyIfSigned()' wrapped page on my server?
So when I do change the url in the example to go directly to my page I can
only get that page to work if I call '$server->verifyIfSigned(false)', ie.
a token_type of false.
In this way i'm not able to call the same page in both normal three legged
and two legged!?
Has anyone got this to work? I am quite certain I might be just not
understanding the twolegged use correctly of course :-)
Thanks.
Hello All,
I have made some changes in this great library and added Oracle store.
There is ready Oracle SPs and db schema based on this MySQL store.
I would like to share that with you for more Improvement, so please let me
know how can I contribute with all of you?
Regards
Vinaykant
In OAuthServer.php I found some errors typo.
line 209
{{{
$verififer = null;
}}}
should be
{{{
$verifier = null;
}}}
Great lib. Good work.
@vinaykant.sahu Yes, please send us! Open a new issue and post your patch
there. I can grant you write access to the SVN if necessary.
@vlada.petrovic: Thanks a lot for the notice, already fixed! But please
prefer to open an issue to report bugs next time.
Hello All,
When I try to get an request token, I always get an error like this:
OAuth Verification Failed: Timestamp is out of sequence. Request rejected.
Got 1282506942 last max is 2147483647 allowed skew is 600
with date() I get the correct time and date. So it seems like and integer
overflow.
I would be very happy if you could help me.
hey i have use the library from here and developed an OAuth service
provider with a simple client on kohanaPHP framework, i wish to share with
you guys but i got no svn to comit, since i am using windows and i am not
use to using SVN. but i will fine a way to host it for others to. i did
some modification but you will. any suggestions on how to add an api on the
oauth service now will be help to me since i am just learning and wish to
share with others
@ebot.tabi: please create a new issue and post your code there. I'll add it
to the SVN.
@brun ok thanks i will create a new issue and post my codes then
I really like this library vs. other ones I have found since it has a great
mechanism for storing OAuth credentials. Has anyone out there made a patch
to bring support up to OAuth 1.0a or does anyone know what the status of
this planned support is? Good job on the library in any case.
Great Library! Things work out of the box. I wanted to sign the request
for a twolegged one. Anyone tried this? If so, how?
A very useful library!! I am facing a small hiccup! When I run the
twolegged.php and try to access hello.php in server, I get this error!
ExceptionRequest failed with code 401: OAuth Verification Failed: The
consumer_key "c76f224ae0ea41eaf76a6d26350e1cdd04caa5ffe"
token "0952088aa9b54cae5646dc142ade86a704cab4d96" combination does not
exist or is not enabled
What should I be checking to make it work fine?
Hi, any new informations about xauth?
Enno
Hi Guys, thank you for your great work!
I am using your library, I updated your code in order to use the callback
stored into the oauth_server_registry table;
In particular I have:
1) modified OAuthStoreSQL.php at getConsumerRequestToken function; my code:
{{{
public function getConsumerRequestToken ( $token )
{
$rs = $this->query_row_assoc('
SELECT ost_token as token,
ost_token_secret as token_secret,
osr_consumer_key as consumer_key,
osr_consumer_secret as consumer_secret,
ost_token_type as token_type,
ost_callback_url as callback_url,
osr_application_title as application_title,
osr_application_descr as application_descr,
osr_application_uri as application_uri,
osr_callback_uri as default_callback_uri
FROM oauth_server_token
JOIN oauth_server_registry
ON ost_osr_id_ref = osr_id
WHERE ost_token_type = \'request\'
AND ost_token = \'%s\'
AND ost_token_ttl >= NOW()
', $token);
return $rs;
}
}}}
The modify must be done in your store if you want use my approach
2) I modified the authorizeVerify function in OAuthServer.php in order to
check the default callback uri:
{{{
$cb = $this->getParam('oauth_callback', true);
if ($cb){
$this->session->set('verify_oauth_callback', $cb);
}else if ($rs['default_callback_uri'] != null &&
$rs['default_callback_uri'] != ''){
$this->session->set('verify_oauth_callback',
$rs['default_callback_uri']);
} else {
$this->session->set('verify_oauth_callback', $rs['callback_url']);
}
}}}
In this way people can store a default callback uri and use that.
What do you think about?
Maurizio
http://www.maurizioconventi.com
I am very new to OAuth. I shall describe the use case I want to try, and
somebody kindly tell if that is possible, and if so, point to some
reference for implementation.
I have a php server side site, running Apache2, which uses the httpasswd
for access. Currently every user has an email id and a password (from
us). Is it possible, if these users have a gmail id, they can be
authenticated using their gmail id instead of using the current site
specific password. Of course since everybody may not even eventually have
a gmail id, this need to coexist with the current htpassword
authentication. That is if a user can be authenticated by either method,
access will be granted. It is not a store, there is really no transaction,
other than just login for access to members.
Thank you for your help!
I am using the Most recent release available for download for Server and
have implemented it.
But as Here mentioned in "OOB" section that you will be redirected to
http://oob/?oauth_token=xxxxxxxxxxxxxxx&oauth_verifier=xxxxxxxxxxxx but its
not like that
You will not be redirected as per the implementation from recent build.
So i have made changes to my OAuthServer.php to print the
"verifier" in response to OOB calls like PIN: xxxxxx, so that it can be
entered to client app/mobile app not supporting browser and still will be
able to get access_tokens based on that PIN.
I guesss Twitter and Yahoo may have implemented in that way.
So i did it!
cheers,
nEosAg
@ChackoNeroth
Please read this:
http://code.google.com/googleapps/domain/sso/openid_reference_implementation.html
for using Google Single Sign On OpenID API...
Here's a quick method to have your server try both 2-legged and 3-legged
authentication:
{{{
function _valid_request() {
// At the start of every request handled by your application you can
check if the request contains OAuth authorization information.
if (OAuthRequestVerifier::requestIsSigned())
{
try
{
$req = new OAuthRequestVerifier();
$user_id = $req->verify();
}
catch (OAuthException2 $e)
{
// The request was signed, but failed 3-legged verification, try
2-legged
try
{
$req = new OAuthRequestVerifier();
$extended_info = $req->verifyExtended(false);
$user_id = $extended_info['osr_id']);
}
catch (OAuthException2 $e)
{
// The request was signed, but failed both 2-legged and 3-legged
verification
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: OAuth realm=""');
header('Content-Type: text/plain; charset=utf8');
echo $e->getMessage();
exit();
}
}
// If we have an user_id, then login as that user (for this request)
if ($user_id)
{
// **** Add your own code here ****
return $user_id;
}
}
return FALSE;
Any way to turn off the AuthStore? I'd like to handle this on my own.
Awesome library, but I'm running into a roadblock with sql errors and I'd
like to store the data in my own table (users).
please change code in example :
catch (OAuthException $e)
to
catch (OAuthException2 $e)
Okay, as I understand this, whenever a client/consumer sends a user to my
API to register, it creates a unique entry that holds both client and user.
But I want to set up my API the way Twitter does: namely, a dev has to
register their client/consumer first, are given an API key, and then a
unique token is generated for each user who uses their client.
Is there an easy way to do this, or am I going to have to rewrite a bunch
of SQL code here to make this work?
Hi
I m using this library for a REST based API authentication. I have a
problem about hello.php.
It initializes OAuthServer without any parameters. But with "$params" array
it reads oauth parameters.
So dont we need to pass request header parameters to OAuthserver? Am I
wrong?
Thanks
kasun
*Including user_id on the access_token response*
We've be playing with this great code but one thing we wanted to add was
the user_id to the access_token response ( like twitter does for example )
because you need to know against which user account to store the
credentials. Unless the API you're dealing with provides a simple url that
allows you to fetch the 'authenticated users' credentials you're a bit
stuck - either way that's possibly a superflous request.
Our solution is as follows and posted here for anyone else having the same
problem.
In the *OAuthServer.php* class; the *accessToken()* function calls the
*verifer();*. The response to that call is the user_id... but it's
discarded. Therefore edit the first line of code to read:
{{{
$user_id = $this->verify('request');
}}}
Then further down in the method, after we've compiled all the other bits of
the return string, simply add the following:
{{{
if (!empty($user_id)){
$result .= '&user_id='.$this->urlencode($user_id);
}
}}}
Job done.
Very interested to know if anyone says it's bad behaviour to provide this
information at this juncture. As I say twitter does it so that would make
it pretty common behaviour.
Hope this helps someone.
Jimbo
Thats weird, I've had/got the same error message as
luisbati...@domdigital.com from above.
What "solved" the issue for me was to give the arguments to the arguments
to the url in the same order as reported by the "signature base string" in
the error message. That error message had the first two arguments (my
custom arguments) in the url swapped.
I did the same in the actual request and the signature error was gone.
Is there anything ordered in the list of arguments? Any way to avoid that?
Thanks,
Thomas
Ok, maybe I found it.
getNormalizedParams has a line:
ksort($params);
which, well, sorts the params by key.
So the signature for checking is generated on ordered params in the url
while the signature delivered from the app is generated on the order the
params are given in => mismatch.
Therefore the question is:
Is that ksort in any way needed or required?
Please help.
I got a message from login screen
"You must install php5-oauth to use this class"???
though I am using PHP 5.2 (goDaddy host).
What am I missing and how to fix this,
Appreciate your help.
Thanks
Jason.
How can i install this on my server.I dont know how to set env variable
there.
$user_id = 3;
// Request parameters are oauth_token, consumer_key and usr_id.
$consumer_key = "45fd7a0c11640a04859ccc3d5ec0ae2004efd7c78";
$oauth_token = $_GET['oauth_token'];
try {
OAuthRequester::requestAccessToken($consumer_key, $oauth_token,$user_id);
//'POST', $_GET
} catch (OAuthException $e) {
// Something wrong with the oauth_token.
// Could be:
// 1. Was already ok
// 2. We were not authorized
}
Fatal error: Uncaught exception 'OAuthException2' with message 'The
server "http://auth.service.com/access_token.php" did not return the
oauth_token or the oauth_token_secret' in
D:\AppServ\www\demo\oauth-php\library\OAuthRequester.php:281 Stack trace:
#0 D:\AppServ\www\demo\test.php(14):
OAuthRequester::requestAccessToken('45fd7a0c11640a0...', '595e0ee21c8aa09...',
3, 'POST', Array) #1 {main} thrown in
D:\AppServ\www\demo\oauth-php\library\OAuthRequester.php on line 281
access_token.php
<?php
include_once 'oauth-php/library/OAuthServer.php';
$server = new OAuthServer();
$rs = $server->accessToken();
?>
server access_token.php error why?
Hi guys,
I don't quite get the concept of the user_id (partly due to confusing
comments in the example code).
So I understand the fact that a user gives permission to consumers to
access something. As I understand the user_id has to be passed to register
a consumer ( so a user has to be logged in, in order to allow a consumer to
register with the OAuth server?? ) Then when u authorize an unauth. request
token again u have to pass along the user_id... So is this something you
store per user in your server ( i.e. John Doe = user_id 6; Jane Doe =
user_id 88 ) I read somewhere this should be stored in session so I think
that's just to remember that john doe has logged in and you store his
user_id in the session....?
A little explanation or confirmation would help me sooo much !!!
Thx in advance, and nice framework !!
Jan
Hey guys,
is there any sample code on how to get this server to work with the
2-legged version of the Oauth Store?
The one that's included with the library just stores the consumer token and
secret.
How does one use this?
Thanks!
Hello,
i am confused with it. will anyone tell me from where i start? i need to
implement the three legged for Single Sign On.
please help,
Thanks