I am using cakePHP 2.x . Currently doing about the twitter OAuth, http://code.42dh.com/oauth/.
function twitter_authentication()
{
//assume above coding is all correct.
$this->Session->write('twitter_request_token', ($requestToken));
$this->redirect('http://api.twitter.com/oauth/authenticate?force_login=true&oauth_token='.$requestToken->key); //I able to get $requestToken.
}
function twitter_login()
{
$requestToken = $this->Session->read('twitter_request_token');
$accessToken = $this->OAuthConsumer->getAccessToken('Twitter','https://api.twitter.com/oauth/access_token', $requestToken);
At function_login(), I failed to read session and ended up with PhP Incomplete Class. If I do $this->Session->write('twitter_request_token', serialize($requestToken));
and $requestToken = $this->Session->read(unserialize('twitter_request_token');
it will work, but I will ended up error at other places which caused by using serialize and unserialize session.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…