public function doAuthFlow($mode, $url = null, $errorMessage)
    {
        $callback = $url ?: $this->getCallbackUrl();

        $this->destroy();

        $this->twitter->setToken(null, null);

        $this->response = $this->api('POST', 'oauth/request_token', array('oauth_callback' => $callback));

        if ($this->responseOk()) {
            $token = $this->response->oauth_token;
            $token_secret = $this->response->oauth_token_secret;

            $this->setToken($token, $token_secret);

            $this->session->put('oauth_request_token', $token);
            $this->session->put('oauth_request_token_secret', $token_secret);
            $this->session->put('oauth_request_verify', true);

            $method = 'get' . ucfirst($mode) . 'Url';
            $authUrl = $this->$method();

            return $this->redirect->to($authUrl);
        }

        $this->triggerError($errorMessage);
    }
public function doAuthFlow($mode, $url = null, $errorMessage)
    {
        $callback = $url ?: $this->getCallbackUrl();

        $this->destroy();

        $this->twitter->setToken(null, null);

        $this->response = $this->api('POST', 'oauth/request_token', array('oauth_callback' => $callback));

        if ($this->responseOk()) {
            $token = $this->response->oauth_token;
            $token_secret = $this->response->oauth_token_secret;

            $this->setToken($token, $token_secret);

            $this->session->put('oauth_request_token', $token);
            $this->session->put('oauth_request_token_secret', $token_secret);
            $this->session->put('oauth_request_verify', true);

            $method = 'get' . ucfirst($mode) . 'Url';
            $authUrl = $this->$method();

            return $this->redirect->to($authUrl);
        }

        $this->triggerError($errorMessage);
    }
public function doAuthFlow ( $ mode , $ url = null , $ errorMessage ) { $ callback = $ url ? : $ this -> getCallbackUrl ( ) ; $ this -> destroy ( ) ; $ this -> twitter -> setToken ( null , null ) ; $ this -> response = $ this -> api ( 'POST' , 'oauth/request_token' , array ( 'oauth_callback' => $ callback ) ) ; if ( $ this -> responseOk ( ) ) { $ token = $ this -> response -> oauth_token ; $ token_secret = $ this -> response -> oauth_token_secret ; $ this -> setToken ( $ token , $ token_secret ) ; $ this -> session -> put ( 'oauth_request_token' , $ token ) ; $ this -> session -> put ( 'oauth_request_token_secret' , $ token_secret ) ; $ this -> session -> put ( 'oauth_request_verify' , true ) ; $ method = 'get' . ucfirst ( $ mode ) . 'Url' ; $ authUrl = $ this -> $ method ( ) ; return $ this -> redirect -> to ( $ authUrl ) ; } $ this -> triggerError ( $ errorMessage ) ; }
Authenticates or authorizes to twitter.

@param string $mode Either 'authenticate' or 'authorize'
@param string|null $url
@param $errorMessage
@throws Exceptions\TwitterApiException
@return \Illuminate\Http\RedirectResponse
Authenticates or authorizes to twitter .