Re: [twitter-dev] Re: xAuth - favorites/create - bug - 401 error
The URL to create a favorite using the API is a POST to: /1/favorites/create/id.format So in your case it would be: /1/favorites/create/16170711730.json Give that a try and let us know how it goes. I know the docs on dev.twitter.com are incorrect for this so i'll be updating them soon. On Wed, Jun 16, 2010 at 2:46 PM, chiu ming luk wrote: > Request = > /1/favorites/create.json? > > id=16170711730&oauth_consumer_key=vfM8qYNAEBfZsofKDNX65Q&oauth_nonce=6c2b0e1a7af3dd0b60680c8860e63454&oauth_signature=zZyk1NxKlpXZEapSszao6PCIAQM > %3D&oauth_signature_method=HMAC- > SHA1&oauth_timestamp=1276724507&oauth_token=13073932- > seUruGITdpHxCJsoUhpjectP4hpdRubW62Q7nftyA&oauth_version=1.0 > > signature base string = > zZyk1NxKlpXZEapSszao6PCIAQM= > > $signature = $this->build_signature($signature_method, $consumer, > $token); > > thanks > -chiu > > On Jun 16, 12:57 pm, Taylor Singletary > wrote: > > Hi Chiu, > > > > You're going to want to reset your keys on your application settings on > > dev.twitter.com -- we will really recommend not posting your consumer > > secrets to the group -- but easy to rectify if you go and change your > keys. > > > > Your signature base string is actually a bit different than your keys. In > > many OAuth libraries, they are difficult to access while other libraries > > will make it easy. If you trace your code execution path through the > OAuth > > library you are using, you will find the step where your signature base > > string is created -- that particular string holds most of the things that > > can go wrong in an OAuth request. > > > > Taylor > > > > On Wed, Jun 16, 2010 at 12:53 PM, chiu ming luk >wrote: > > > > > Hi Taylor, > > > > > Thanks for the prompt reply > > > > > thanks > > > -chiu > > > > > On Jun 16, 12:35 pm, Taylor Singletary > > > wrote: > > > > Can you share your signature base string that was used to create this > > > > request? > > > > > > I also highly recommending using HTTP Header-based OAuth instead of > > > > query-string based OAuth. It separates concerns and makes debugging > much > > > > simpler. > > > > > > Taylor Singletary > > > > Developer Advocate, Twitterhttp://twitter.com/episod > > > > > > On Wed, Jun 16, 2010 at 11:44 AM, chiu ming luk < > lukchium...@gmail.com > > > >wrote: > > > > > > > The xAuth - favorites/create - is broken > > > > > > > I make calls to - favorites/create with an ID parameter using > "xAuth" > > > > > > > $response = $connection->get ( 'favorites/create', array ('id' => > > > > > $status_id ) ); > > > > > > > but I always getting 401 "Not authorized" Error > > > > > > > === > > > > > /1/favorites/create.json? > > > > > > id=16170711730&oauth_consumer_key=vfM8qYNAEBfZsofKDNX65Q&oauth_nonce=bde7b35f5206ebc8a2cc31a7ea2b86ac&oauth_signature=V6%2BeC7%2FODp42W6GPV4EDWNpvSqY > > > > > %3D&oauth_signature_method=HMAC- > > > > > SHA1&oauth_timestamp=1276713005&oauth_token=13073932- > > > > > seUruGITdpHxCJsoUhpjectP4hpdRubW62Q7nftyA&oauth_version=1.0 > > > > > === > > > > > > > On the other hand, The exact same request using "Basic > > > > > Authentication", It will work fine. I either getting > > > > > - You have already favorited this status. > > > > > - Favorites added > > > > > -- Matt Harris Developer Advocate, Twitter http://twitter.com/themattharris
Re: [twitter-dev] Re: xAuth - favorites/create - bug - 401 error
Let us continue this on the issue tracker so we don't spam the list as much: http://github.com/abraham/twitteroauth/issues#issue/33 Abraham - Abraham Williams | Hacker Advocate | http://abrah.am @abraham | http://projects.abrah.am | http://blog.abrah.am This email is: [ ] shareable [x] ask first [ ] private. On Wed, Jun 16, 2010 at 14:42, chiu ming luk wrote: > The signature base string is the following > zZyk1NxKlpXZEapSszao6PCIAQM= > > $signature = $this->build_signature($signature_method, $consumer, > $token); > > thanks > -chiu > > > On Jun 16, 12:57 pm, Taylor Singletary > wrote: > > Hi Chiu, > > > > You're going to want to reset your keys on your application settings on > > dev.twitter.com -- we will really recommend not posting your consumer > > secrets to the group -- but easy to rectify if you go and change your > keys. > > > > Your signature base string is actually a bit different than your keys. In > > many OAuth libraries, they are difficult to access while other libraries > > will make it easy. If you trace your code execution path through the > OAuth > > library you are using, you will find the step where your signature base > > string is created -- that particular string holds most of the things that > > can go wrong in an OAuth request. > > > > Taylor > > > > On Wed, Jun 16, 2010 at 12:53 PM, chiu ming luk >wrote: > > > > > Hi Taylor, > > > > > Thanks for the prompt reply > > > > > thanks > > > -chiu > > > > > On Jun 16, 12:35 pm, Taylor Singletary > > > wrote: > > > > Can you share your signature base string that was used to create this > > > > request? > > > > > > I also highly recommending using HTTP Header-based OAuth instead of > > > > query-string based OAuth. It separates concerns and makes debugging > much > > > > simpler. > > > > > > Taylor Singletary > > > > Developer Advocate, Twitterhttp://twitter.com/episod > > > > > > On Wed, Jun 16, 2010 at 11:44 AM, chiu ming luk < > lukchium...@gmail.com > > > >wrote: > > > > > > > The xAuth - favorites/create - is broken > > > > > > > I make calls to - favorites/create with an ID parameter using > "xAuth" > > > > > > > $response = $connection->get ( 'favorites/create', array ('id' => > > > > > $status_id ) ); > > > > > > > but I always getting 401 "Not authorized" Error > > > > > > > === > > > > > /1/favorites/create.json? > > > > > > id=16170711730&oauth_consumer_key=vfM8qYNAEBfZsofKDNX65Q&oauth_nonce=bde7b35f5206ebc8a2cc31a7ea2b86ac&oauth_signature=V6%2BeC7%2FODp42W6GPV4EDWNpvSqY > > > > > %3D&oauth_signature_method=HMAC- > > > > > SHA1&oauth_timestamp=1276713005&oauth_token=13073932- > > > > > seUruGITdpHxCJsoUhpjectP4hpdRubW62Q7nftyA&oauth_version=1.0 > > > > > === > > > > > > > On the other hand, The exact same request using "Basic > > > > > Authentication", It will work fine. I either getting > > > > > - You have already favorited this status. > > > > > - Favorites added > > > > >
Re: [twitter-dev] Re: xAuth - favorites/create - bug - 401 error
favorites/create should be a POST. Try: $response = $connection->post( 'favorites/create', array ('id' => $status_id ) ); Abraham - Abraham Williams | Hacker Advocate | http://abrah.am @abraham | http://projects.abrah.am | http://blog.abrah.am This email is: [ ] shareable [x] ask first [ ] private. On Wed, Jun 16, 2010 at 12:57, Taylor Singletary < taylorsinglet...@twitter.com> wrote: > Hi Chiu, > > You're going to want to reset your keys on your application settings on > dev.twitter.com -- we will really recommend not posting your consumer > secrets to the group -- but easy to rectify if you go and change your keys. > > Your signature base string is actually a bit different than your keys. In > many OAuth libraries, they are difficult to access while other libraries > will make it easy. If you trace your code execution path through the OAuth > library you are using, you will find the step where your signature base > string is created -- that particular string holds most of the things that > can go wrong in an OAuth request. > > Taylor > > On Wed, Jun 16, 2010 at 12:53 PM, chiu ming luk wrote: > >> Hi Taylor, >> >> Thanks for the prompt reply >> >> >> >> thanks >> -chiu >> >> >> On Jun 16, 12:35 pm, Taylor Singletary >> wrote: >> > Can you share your signature base string that was used to create this >> > request? >> > >> > I also highly recommending using HTTP Header-based OAuth instead of >> > query-string based OAuth. It separates concerns and makes debugging much >> > simpler. >> > >> > Taylor Singletary >> > Developer Advocate, Twitterhttp://twitter.com/episod >> > >> > On Wed, Jun 16, 2010 at 11:44 AM, chiu ming luk > >wrote: >> > >> > > The xAuth - favorites/create - is broken >> > >> > > I make calls to - favorites/create with an ID parameter using "xAuth" >> > >> > > $response = $connection->get ( 'favorites/create', array ('id' => >> > > $status_id ) ); >> > >> > > but I always getting 401 "Not authorized" Error >> > >> > > === >> > > /1/favorites/create.json? >> > >> > > >> id=16170711730&oauth_consumer_key=vfM8qYNAEBfZsofKDNX65Q&oauth_nonce=bde7b35f5206ebc8a2cc31a7ea2b86ac&oauth_signature=V6%2BeC7%2FODp42W6GPV4EDWNpvSqY >> > > %3D&oauth_signature_method=HMAC- >> > > SHA1&oauth_timestamp=1276713005&oauth_token=13073932- >> > > seUruGITdpHxCJsoUhpjectP4hpdRubW62Q7nftyA&oauth_version=1.0 >> > > === >> > >> > > On the other hand, The exact same request using "Basic >> > > Authentication", It will work fine. I either getting >> > > - You have already favorited this status. >> > > - Favorites added >> > >> > >> > >
Re: [twitter-dev] Re: xAuth - favorites/create - bug - 401 error
Hi Chiu, You're going to want to reset your keys on your application settings on dev.twitter.com -- we will really recommend not posting your consumer secrets to the group -- but easy to rectify if you go and change your keys. Your signature base string is actually a bit different than your keys. In many OAuth libraries, they are difficult to access while other libraries will make it easy. If you trace your code execution path through the OAuth library you are using, you will find the step where your signature base string is created -- that particular string holds most of the things that can go wrong in an OAuth request. Taylor On Wed, Jun 16, 2010 at 12:53 PM, chiu ming luk wrote: > Hi Taylor, > > Thanks for the prompt reply > > > > thanks > -chiu > > > On Jun 16, 12:35 pm, Taylor Singletary > wrote: > > Can you share your signature base string that was used to create this > > request? > > > > I also highly recommending using HTTP Header-based OAuth instead of > > query-string based OAuth. It separates concerns and makes debugging much > > simpler. > > > > Taylor Singletary > > Developer Advocate, Twitterhttp://twitter.com/episod > > > > On Wed, Jun 16, 2010 at 11:44 AM, chiu ming luk >wrote: > > > > > The xAuth - favorites/create - is broken > > > > > I make calls to - favorites/create with an ID parameter using "xAuth" > > > > > $response = $connection->get ( 'favorites/create', array ('id' => > > > $status_id ) ); > > > > > but I always getting 401 "Not authorized" Error > > > > > === > > > /1/favorites/create.json? > > > > > > id=16170711730&oauth_consumer_key=vfM8qYNAEBfZsofKDNX65Q&oauth_nonce=bde7b35f5206ebc8a2cc31a7ea2b86ac&oauth_signature=V6%2BeC7%2FODp42W6GPV4EDWNpvSqY > > > %3D&oauth_signature_method=HMAC- > > > SHA1&oauth_timestamp=1276713005&oauth_token=13073932- > > > seUruGITdpHxCJsoUhpjectP4hpdRubW62Q7nftyA&oauth_version=1.0 > > > === > > > > > On the other hand, The exact same request using "Basic > > > Authentication", It will work fine. I either getting > > > - You have already favorited this status. > > > - Favorites added > > > > >