flijten / oauth-consumer Goto Github PK
View Code? Open in Web Editor NEWCode demonstrating an implementation of an OAuth provider using PECL's OAuth class
License: Other
Code demonstrating an implementation of an OAuth provider using PECL's OAuth class
License: Other
In authorize.php, the IF / ELSE IF statement on lines 22 and 50 are the same statement, so the else could never get executed:
https://github.com/flijten/OAuth-consumer/blob/master/src/example/provider/authorize.php#L22-L50
hi, i use this tutorial to began my journey with OAuth -> http://www.freeklijten.nl/home/2011/10/19/Writing-an-OAuth-Provider-in-PHP
i follow the instructions step by step, but when i try to generate consumer key and secret key, i stuck by this error :
"
Fatal error: Class 'OAuthProvider' not found in D:\xampp\htdocs\gutasaputra\OAuth-1\src\OAuthProviderWrapper.php on line 92 "
i search OAuthProvider class in the source code that you gave, but i cant find nothing. can you tell me how to fix this one?
thanks
I have used the provider example in my project, but the functions "consumerHandler" / "timestampNonceHandler" are never called, when calling : $provider->checkOAuthRequest()
.
Here is my code :
public function request_token()
{
$provider = new \OAuthProvider();
$provider->consumerHandler([$this,'consumerHandler']);
$provider->timestampNonceHandler([$this,'timestampNonceHandler']);
$provider->isRequestTokenEndpoint(true);
$provider->setConsumerKey(self::$consumerClep);
$response = $provider->checkOAuthRequest();
if ($response !== true)
{
echo $response;
return;
}
// ...
}
public function consumerHandler($provider)
{
//Consumer Handler
}
public function timestampNonceHandler($provider)
{
//Timestamp Nonce Handler
}
Can someone explain me why "checkOAuthRequest" doesn't call the handlers ? Or am I using oauth incorrectly ?
Thank you very much
I get the following error when attempting to perform the handshake with the provided example code. I had done all the steps up to that point correctly.
http://oauth.local/example/consumer/get_request_token.php
array(1) {
'
Fatal_error:_Uncaught_exception_\'DataStoreReadException\'_with_message_\'Couldn\'t_create_the_request_token_data_in_the_datastore\'_in_/Volumes/Server/copy/oauth/src/model/OAuthRequestTokenModel_php_on_line_143
DataStoreReadException:_Couldn\'t_create_the_request_token_data_in_the_datastore_in_/Volumes/Server/copy/oauth/src/model/OAuthRequestTokenModel_php_on_line_143
Call_Stack:
____0_0002_____248288___1__{main}()_/Volumes/Server/oauth/src/example/provider/request_token_php:0
____0_0073_____413464___2__OAuthProviderWrapper->outputRequestToken()_/Volumes/Server/oauth/src/example/provider/request_token_php:16
____0_0084_____467664___3__ModelBase->save()_/Volumes/Server/oauth/src/OAuthProviderWrapper_php:114
____0_0084_____467784___4__OAuthRequestTokenModel->create()_/Volumes/Server/oauth/src/model/ModelBase_php:68
' =>
string(0) ""
}
While hunting around, it looks like OAuthRequestTokenModel::create()
is attempting to perform a MySQL INSERT, but the value of $this->tokenUserId is empty, and that query fails. Any thoughts as to what the issue could be?
PHP 5.4.11
MySQL 5.6.10
When we call the timestampNonceHandler method (OAuthProviderWrapper), the save method (OAuthNonceModel which extends ModelBase) was executed with a id (= the nonce) defined.
So, finally, we will call the update method (OAuthNonceModel) in place of the create method.
I think, it's a bug ?
Sorry for my bad english :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.