artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
684 stars 216 forks source link

Cant send tweet using from this package #73

Open ntwobike opened 10 years ago

ntwobike commented 10 years ago

This is my controller action anything i missing here,

    $code = Input::get( 'oauth_token' );
   $oauth_verifier = Input::get( 'oauth_verifier' );

    // get fb service
    $twitterService = Artdarek\OAuth\Facade\OAuth::consumer( 'Twitter' );

    // if code is provided get user data and sign in
    if ( !empty( $code ) ) {

        $token = $twitterService->getStorage()->retrieveAccessToken('Twitter');

        // This was a callback request from google, get the token
        $twitterService->requestAccessToken( $code, $oauth_verifier, $token->getRequestTokenSecret() );

        $status = json_decode($twitterService->request('statuses/update.json' , 'POST' , "Sample tweet" ));
    }else {

        // extra request needed for oauth1 to request a request token :-)
        $token = $twitterService->requestRequestToken();
        $url = $twitterService->getAuthorizationUri(['oauth_token' => $token->getRequestToken()]);
        // return to twitter login url
        return Redirect::to((string)$url);
    }
i3zhe commented 10 years ago

What is the error message you got? Probably the permission setting on the twitter's dev console.