feedbin / feedbin-api

Feedbin API Documentation
349 stars 26 forks source link

401 responses when trying to subscribe to a feed to which user is already subscribed #17

Open jbrayton opened 8 years ago

jbrayton commented 8 years ago

Using this endpoint:

https://api.feedbin.com/v2/subscriptions.json

If I subscribe to a new feed, I get a 201 response as expected. However, if I try to subscribe to a feed to which I am already subscribed, I often get a 401 instead of a 302. I am replaying the request that I first used to subscribe.

I feel confident that my "Authorization" header is correct. Any idea why I would be getting a 401?

benubois commented 8 years ago

Hi @jbrayton,

Sorry for the trouble. Unfortunately I'm not able to reproduce this issue.

Can you reproduce this issue using curl or provide the complete HTTP request and response?

HTTP libraries often abstract the actual HTTP so it's tough to see where the error might be. The best way I've found for debugging client code is to use Charles.

Something like the following would be great. Keep in mind to blank out your credentials.

curl -svu 'example@example.com:XXX' -H "Content-Type: application/json; charset=utf-8" -d '{"feed_url": "http://daringfireball.net/index.xml"}'  https://api.feedbin.com/v2/subscriptions.json
*   Trying 184.173.139.245...
* Connected to api.feedbin.com (184.173.139.245) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: feedbin.com
* Server certificate: Starfield Secure Certificate Authority - G2
* Server certificate: Starfield Root Certificate Authority - G2
* Server auth using Basic with user 'ben@benubois.com'
> POST /v2/subscriptions.json HTTP/1.1
> Host: api.feedbin.com
> Authorization: Basic XXX
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json; charset=utf-8
> Content-Length: 51
> 
* upload completely sent off: 51 out of 51 bytes
< HTTP/1.1 302 Found
< Server: nginx/1.8.0
< Date: Sun, 06 Dec 2015 23:10:06 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 185
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Location: https://api.feedbin.com/v2/subscriptions/2682723.json
< Cache-Control: no-cache
< Set-Cookie: XSRF-TOKEN=sf8NKL7CMJnsI8KY9PHMBLy1M8lqw2lCbqh8BMR6Bf5PIBX6wFh0Sn1jDKLNY2%2F2OUlGTH3Ocw9ZzgX2cC9LeA%3D%3D; path=/; secure
< Set-Cookie: _session_id=WG03aVE2ajdGWGwxdEo5bnlZNXJSVVFNbDlaSTdsSEFqRTBwekRRdkJ6S0NHZnJ0MlhMSGtZK20xZ0tlTktRb3daeWMxcGgwbFVQNzR3dlVOYjlGTWgvYUVGNmwvS3V6eVlkK1Bid0xHYU1KU3JYMGQ5NWkySW1heHRrVXh5bFRsQmVDTGNLczMveWNGb3hUZUZpYWZ0RFo1NjdMQ2VGd00wdHhOSUgwVU9WRUpXaU02VnhZeFBVaDBwdzVOVjBCLS1FOGVlOVJ1eEJJdi9WZU5LMS9neTFBPT0%3D--6c16c11825c70486ff793cd929ef6a2785a69b14; path=/; secure; HttpOnly
< X-Runtime: 0.068169
< Strict-Transport-Security: max-age=31536000
< X-Feedbin-Request-ID: 49AA39AE:A7B0_B8AD8BF5:01BB_5664C063_EC9FA7:053B
< 
* Connection #0 to host api.feedbin.com left intact
{"id":2682723,"created_at":"2014-09-20T02:43:14.513439Z","feed_id":47,"title":"Daring Fireball","feed_url":"http://daringfireball.net/index.xml","site_url":"http://daringfireball.net/"}