artdarek / oauth-4-laravel

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

Twitter Auth - Failed to request resource #68

Closed ACTwebDesigns closed 10 years ago

ACTwebDesigns commented 10 years ago

I have seen that a lot of people are having this problem but non of the "fixes" are working for me.

the problem is down to

$token = $twitterService->requestRequestToken();

/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php line 68

I think the main problem is that the code is only a small part of the signin process so I have a few questions which should sort this.

  1. how is the config structured, i have the following:

'consumers' => array(

'Facebook' => array(
    'client_id'     => '',
    'client_secret' => '',
    'scope'         => array(),
),

'Twitter' => array(
    'key'   => '',
    'secret' => ''
)

)

  1. how is the application in the twitter panel supposed to be setup?

I have a callback url set (even though its local) and I have the "allow this application to sign in..." ticked.

Is there anything else here?

jamesrwhite commented 10 years ago

I'm having the same issue :(

cmosboss commented 10 years ago

as am I, I made #69 before reading this, same thing

ACTwebDesigns commented 10 years ago

drivin me nuts!! @artdarek ??

ACTwebDesigns commented 10 years ago

just looking at the request before the error is sent:

Array
(
    [Authorization] => Authorization: OAuth oauth_callback="http%3A%2F%2Ffoobarr.com%2Ftwitter-login", oauth_consumer_key="", oauth_nonce="ITgEH3PI2VbILCFJ1eKhv9bk8ruiUEQs", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1401709726", oauth_version="1.0", oauth_signature="xgabXcEma5FzClWZ83WeBXD2MVw%3D"
    [Content-type] => Content-type: application/x-www-form-urlencoded
    [Host] => Host: api.twitter.com
    [Connection] => Connection: close
    [Content-length] => Content-length: 0
)

looks like no value in the oauth_consumer_key.... hmmm

artdarek commented 10 years ago

configuration should look like this:

        'Twitter' => [
            'client_id'     => '***********************************',
            'client_secret' => '*****************************',
            'scope'         => array(),
        ],

so for Twitter 'key' = 'client_id' and 'secret' = 'client_secret'

ACTwebDesigns commented 10 years ago

and thats a winner!

robinflyhigh commented 10 years ago

Hello @ACTwebDesigns

We did change the configuration but still see the same error, can you shed some light.

Request URL : https://api.twitter.com/oauth/request_token

Request Dump : Array ( [Authorization] => Authorization: OAuth oauth_callback="http%3A%2F%2Ffoo.localhost%2Flogin%2Ftwitter", oauth_consumer_key="YuYSAsaof9LuQmmlsgnNeB9ol", oauth_nonce="NhmsRA57hxXhygeOCkB4ZPjQAn4xU45Y", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1402316198", oauth_version="1.0", oauth_signature="14TSbHco%2F%2B6oV5aBrr0QEtXpmnY%3D" [Content-type] => Content-type: application/x-www-form-urlencoded [Host] => Host: api.twitter.com [Connection] => Connection: close [Content-length] => Content-length: 0 )

Config Value: 'Twitter' => array( 'client_id' => '_mmlsgnNeB9ol', 'client_secret' => '_SKfzYoilriz1Q6ndlhzq7JUq5exlV5sQcVFrP0LJMB', 'scope' => array(), ),