Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Call to a member function oauth_requestToken() on null in C:\xampp\htdocs\logintwitter\app\TwitterAuth.php on line 21 #229

Open
PerezLopezRoberto opened this issue Apr 7, 2018 · 2 comments

Comments

@PerezLopezRoberto
Copy link

PerezLopezRoberto commented Apr 7, 2018

I am working on twitter sign-up on my web application and I have an issue that I am not quite sure what the problem is.

-----------TwitterAuth.php-----------

`
class TwitterAuth{

protected $cliente;
protected $clienteCallback = "http://127.0.0.1/logintwitter/callback.php";

public function _construct(\Codebird\Codebird $cliente){
	$this->cliente = $cliente;		
}

public function getAuthUrl(){
	$this->requestTokens();
	$this->verifyTokens();
	
	return $this->cliente->oauth_authenticate();
}

public function requestTokens(){	

	$reply = $this->cliente->oauth_requestToken([
	'oauth_callback' => $this->clienteCallback
	]);		
	
	$this->storeTokens($reply->oauth_token, $reply->oauth_token_secret);
	
}

protected function storeTokens($token,$tokenSecret){
	$_SESSION['oauth_token'] = $token;
	$_SESSION['oauth_token_secret'] = $tokenSecret;
}

public function verifyTokens(){
	$this->cliente->setToken($_SESSION['oauth_token'],$_SESSION['oauth_token_secret']);
}

public function isLogin(){
	return false;
}

}`

-----------init.php-----------

` session_start();

require_once('vendor/autoload.php');
require_once('app/TwitterAuth.php');

\Codebird\Codebird::setConsumerKey('xxxxxxxx','xxxxxxxxxxxxxxxx');

$cliente = \Codebird\Codebird::getInstance();`

-----------index.php-----------

`require_once('app/init.php');

$auth = new TwitterAuth($cliente);

if($auth->isLogin()){
echo "

Esta en el sistema. Cerrar Sesion

";
}else{
echo $auth->getAuthUrl();
}`

@lepfsd
Copy link

lepfsd commented May 15, 2018

hello, u solved that ? my Codebird::getInstance(); return null

@mynetx
Copy link
Member

mynetx commented Oct 28, 2018

@lepfsd Can you tell me more details about your null return value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants