public function connectOauth1($options)
    {
        $token = false;

        // source oauth provider
        $oauthProvider = $this->getProvider();

        // denied
        if(\Craft\craft()->request->getParam('denied'))
        {
            throw new \Exception("An error occured: ".\Craft\craft()->request->getParam('denied'));
        }

        $user = \Craft\craft()->request->getParam('user');
        $oauth_token = \Craft\craft()->request->getParam('oauth_token');
        $oauth_verifier = \Craft\craft()->request->getParam('oauth_verifier');
        $denied = \Craft\craft()->request->getParam('denied');

        if ($oauth_token && $oauth_verifier)
        {
            $temporaryCredentials = unserialize(\Craft\craft()->httpSession->get('temporary_credentials'));

            $token = $oauthProvider->getTokenCredentials($temporaryCredentials, $oauth_token, $oauth_verifier);

            \Craft\craft()->httpSession->add('token_credentials', serialize($token));

            OauthPlugin::log('OAuth 1.0 Connect - Get token credentials'."\r\n".print_r([
                'temporaryCredentials' => $temporaryCredentials,
                'oauth_token' => $oauth_token,
                'oauth_verifier' => $oauth_verifier,
                'token' => $token,
            ], true), LogLevel::Info);
        }
        elseif ($denied)
        {
        	$errorMsg = "Client access denied by user";

            OauthPlugin::log('OAuth 1.0 Connect - '.$errorMsg, LogLevel::Info);

            throw new \Exception($errorMsg);
        }
        else
        {
            $temporaryCredentials = $oauthProvider->getTemporaryCredentials();

            \Craft\craft()->httpSession->add('temporary_credentials', serialize($temporaryCredentials));

            $authorizationUrl = $oauthProvider->getAuthorizationUrl($temporaryCredentials);
            \Craft\craft()->request->redirect($authorizationUrl);


	        OauthPlugin::log('OAuth 1.0 Connect - Redirect to the authorization URL'."\r\n".print_r([
		        'temporaryCredentials' => $temporaryCredentials,
                'authorizationUrl' => $authorizationUrl,
		    ], true), LogLevel::Info);
        }

        return $token;
    }
public function connectOauth1($options)
    {
        $token = false;

        // source oauth provider
        $oauthProvider = $this->getProvider();

        // denied
        if(\Craft\craft()->request->getParam('denied'))
        {
            throw new \Exception("An error occured: ".\Craft\craft()->request->getParam('denied'));
        }

        $user = \Craft\craft()->request->getParam('user');
        $oauth_token = \Craft\craft()->request->getParam('oauth_token');
        $oauth_verifier = \Craft\craft()->request->getParam('oauth_verifier');
        $denied = \Craft\craft()->request->getParam('denied');

        if ($oauth_token && $oauth_verifier)
        {
            $temporaryCredentials = unserialize(\Craft\craft()->httpSession->get('temporary_credentials'));

            $token = $oauthProvider->getTokenCredentials($temporaryCredentials, $oauth_token, $oauth_verifier);

            \Craft\craft()->httpSession->add('token_credentials', serialize($token));

            OauthPlugin::log('OAuth 1.0 Connect - Get token credentials'."\r\n".print_r([
                'temporaryCredentials' => $temporaryCredentials,
                'oauth_token' => $oauth_token,
                'oauth_verifier' => $oauth_verifier,
                'token' => $token,
            ], true), LogLevel::Info);
        }
        elseif ($denied)
        {
        	$errorMsg = "Client access denied by user";

            OauthPlugin::log('OAuth 1.0 Connect - '.$errorMsg, LogLevel::Info);

            throw new \Exception($errorMsg);
        }
        else
        {
            $temporaryCredentials = $oauthProvider->getTemporaryCredentials();

            \Craft\craft()->httpSession->add('temporary_credentials', serialize($temporaryCredentials));

            $authorizationUrl = $oauthProvider->getAuthorizationUrl($temporaryCredentials);
            \Craft\craft()->request->redirect($authorizationUrl);


	        OauthPlugin::log('OAuth 1.0 Connect - Redirect to the authorization URL'."\r\n".print_r([
		        'temporaryCredentials' => $temporaryCredentials,
                'authorizationUrl' => $authorizationUrl,
		    ], true), LogLevel::Info);
        }

        return $token;
    }
public function connectOauth1 ( $ options ) { $ token = false ; // source oauth provider $ oauthProvider = $ this -> getProvider ( ) ; // denied if ( \ Craft \ craft ( ) -> request -> getParam ( 'denied' ) ) { throw new \ Exception ( "An error occured: " . \ Craft \ craft ( ) -> request -> getParam ( 'denied' ) ) ; } $ user = \ Craft \ craft ( ) -> request -> getParam ( 'user' ) ; $ oauth_token = \ Craft \ craft ( ) -> request -> getParam ( 'oauth_token' ) ; $ oauth_verifier = \ Craft \ craft ( ) -> request -> getParam ( 'oauth_verifier' ) ; $ denied = \ Craft \ craft ( ) -> request -> getParam ( 'denied' ) ; if ( $ oauth_token && $ oauth_verifier ) { $ temporaryCredentials = unserialize ( \ Craft \ craft ( ) -> httpSession -> get ( 'temporary_credentials' ) ) ; $ token = $ oauthProvider -> getTokenCredentials ( $ temporaryCredentials , $ oauth_token , $ oauth_verifier ) ; \ Craft \ craft ( ) -> httpSession -> add ( 'token_credentials' , serialize ( $ token ) ) ; OauthPlugin :: log ( 'OAuth 1.0 Connect - Get token credentials' . "\r\n" . print_r ( [ 'temporaryCredentials' => $ temporaryCredentials , 'oauth_token' => $ oauth_token , 'oauth_verifier' => $ oauth_verifier , 'token' => $ token , ] , true ) , LogLevel :: Info ) ; } elseif ( $ denied ) { $ errorMsg = "Client access denied by user" ; OauthPlugin :: log ( 'OAuth 1.0 Connect - ' . $ errorMsg , LogLevel :: Info ) ; throw new \ Exception ( $ errorMsg ) ; } else { $ temporaryCredentials = $ oauthProvider -> getTemporaryCredentials ( ) ; \ Craft \ craft ( ) -> httpSession -> add ( 'temporary_credentials' , serialize ( $ temporaryCredentials ) ) ; $ authorizationUrl = $ oauthProvider -> getAuthorizationUrl ( $ temporaryCredentials ) ; \ Craft \ craft ( ) -> request -> redirect ( $ authorizationUrl ) ; OauthPlugin :: log ( 'OAuth 1.0 Connect - Redirect to the authorization URL' . "\r\n" . print_r ( [ 'temporaryCredentials' => $ temporaryCredentials , 'authorizationUrl' => $ authorizationUrl , ] , true ) , LogLevel :: Info ) ; } return $ token ; }
Connect OAuth 1.0
Connect OAuth 1 . 0