artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
683 stars 215 forks source link

Unable to set access token manually #128

Open fobus42 opened 9 years ago

fobus42 commented 9 years ago
$fs=OAuth::consumer( 'Twitter');
$token_interface = new \OAuth\OAuth2\Token\StdOAuth2Token("MYACCESSTOKEN");
$fs->getStorage()->storeAccessToken('Twitter', $token_interface);
$req=$fs->request('statuses/user_timeline.json?screen_name=myname&count=2');

When I try to run this lines, I' gettin the error below on line request(), this error occurs ony with twitter. Am I doing some thing wrong?

Argument 3 passed to OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForAPIRequest() must be an instance of OAuth\OAuth1\Token\TokenInterface, instance of OAuth\OAuth2\Token\StdOAuth2Token given, called in /var/www/kentpark_yarisma/vendor/lusitanian/oauth/src/OAuth/OAuth1/Service/AbstractService.php on line 128 and defined

shellprog commented 9 years ago

Same problem for me i am using OAuth 1 with BitBucket

 $fs=OAuth::consumer( 'BitBucket');
 $token_interface = new \OAuth\OAuth1\Token\StdOAuth1Token($token);
 $fs->getStorage()->storeAccessToken('BitBucket', $token_interface);
 $result = json_decode($fs->request('user/repositories'));

Unable to set access token manually it is showing

TokenResponseException in StreamClient.php line 68:
Failed to request resource.

But for normal redirect flow i am able to request user/repositories but with stored token it is not working . Help will be appreciated .