Reputation: 195
I have set up an OAuthProvider in Zend Framework2 following the guidelines here: https://toys.lerdorf.com/archives/55-Writing-an-OAuth-Provider-Service.html and here: http://www.lornajane.net/posts/2011/php-oauth-provider-request-tokens.
Once I add the line $this->provider->checkOAuthRequest();
I get a bad request:
400 Bad Request: oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key%26oauth_signature%26oauth_nonce%26oauth_timestamp
My Headers are as follow:
Authorization: OAuth oauth_consumer_key="key",oauth_token="qwerty",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1453821463",oauth_nonce="Iu5qXE",oauth_version="1.0",oauth_signature="KOn7AfMCpRCi1Tei1jMLiZ2eZmo%3D"`
All of my headers show up in the request headers, and it doesn't say any of the other parameters are absent like version
or oauth_token
I have tried searching around and keep scratching my head, any help is appreciated.
Thank you.
Upvotes: 2
Views: 246
Reputation: 195
Not sure if this will help others but I found the issue to my solution:
When I instantiated the OAuthProvider()
the first time (as per the docs) it yelled at me to provide a signature method in the constructor, so I did. After days of scratching my head trying to figure out why this kept giving me errors I removed the signature method parameter from the constructor like the references above.
After this change everything seemed to have solved itself out.. I am not sure as to why this happened but it doesn't error back at me now, and sets up the $provider with its oauth parameters.
My Code:
$provider = new OAuthProvider();
$provider->consumerHandler(array($this,'lookupConsumer'));
$provider->timestampNonceHandler(array($this,'lookupNonce'));
$provider->tokenHandler(array($this,'lookupToken'));
$provider->setRequestTokenPath('/oauth/request-token');
$provider->checkOAuthRequest();
Upvotes: 0