Error processing OAuth request: Invalid oauth_verifier parameter, sometimes

oauth
php
api

#1

I have implemented authentication as indicated the twitter page https://dev.twitter.com/web/sign-in/implementing, in my TYPO3 extension using Abraham’s TwitterOauth library. The problem I have is that sometimes it works and sometimes not when I request the access_token of a profile that is being authenticated, in the cases that I do not receive the message : Error processing your OAuth request: Invalid oauth_verifier parameter

The oauth_verifier parameter to send it, I get it from the url http://mywebsite/index.php?id=15&oauth_token=yyyyyyyyyy&oauth_verifier=xxxxxxx and I execute

public function __construct($consumerKey, $consumerSecret, $accessToken = null, $accessTokenSecret = null) 
{	
    	$this->api =  new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
}
...
public function getAccessToken($oauthVerifier){ //$oauthVerifier = xxxxxxx in this example
    	 $accesToken = $this->api->oauth('oauth/access_token', array("oauth_verifier" => "$oauthVerifier"));
    	 return $accesToken;
 }