Twitter OAuth Signup
===

I'm having a new service where people need to signup using twitter to use the service.

the code is basicly standard twitter API but I found something strange when I start running it with visitors

10% of the visitors will get token issue directly in the callback function, I just want to understand is this error from twitter or from my code design.

below is my code PHP (simplified).

PS: Code is using Twitter-Async library and code with CakePHP (but I don't this is related to the issue).


    public function signupcallback() {		
		try{
			$twitterObj = new EpiTwitter($this->Consumer_key, $this->Consumer_secret);
			if(isset($this->params->{'query'}['oauth_verifier'])){
				$oauth_verifier = $this->params->{'query'}['oauth_verifier'];
				$oauth_token = $this->params->{'query'}['oauth_token'];
				$twitterObj->setToken($oauth_token);  
				$token = $twitterObj->getAccessToken(array('oauth_verifier' => $oauth_verifier));
				$oauth_token = $token->oauth_token;
				$oauth_token_secret = $token->oauth_token_secret;
				
				$this->Session->write('oauth_verifier', $oauth_verifier);
				$this->Session->write('oauth_token',$oauth_token);
				$this->Session->write('oauth_token_secret',$oauth_token_secret);


			}elseif($this->Session->read('oauth_verifier')){
				$oauth_verifier =$this->Session->read('oauth_verifier');
				$oauth_token = $this->Session->read('oauth_token');
				$oauth_token_secret = $this->Session->read('oauth_token_secret');
			}
			
			if(($oauth_token=='') || ($oauth_token_secret=='')){
				$this->redirect('/Users/goTwitter'); //signup again!
			}
			

			$twitterObj->setToken($oauth_token, $oauth_token_secret);
			
			$user = $twitterObj->get('/account/verify_credentials.json',array('skip_status'=>1));
		} catch (Exception $e) {
			$this->redirect('/Users/goTwitter');  //signup again!
		}


			