avishaan / lightTribe

LightTribe Backend and Collaboration Doc
2 stars 0 forks source link

Timeline responds with Unauthorized #44

Closed footnote closed 9 years ago

footnote commented 9 years ago

I found that the timeline is responding with Unauthorized v1/posts

avishaan commented 9 years ago

I am getting an ok response when I do it manually and it seems the test cases are passing ok. Can you share the full error with me? Attached is an example of what I get when I run it locally.

image

footnote commented 9 years ago

Am I doing something wrong in this request? I used the same token that you have passed to me. screen shot 2015-06-23 at 3 43 51 am

avishaan commented 9 years ago

I need to know what the response was you got for the above.

footnote commented 9 years ago

Response URL

http://lighttribe-dev.herokuapp.com:80/api/v1/posts?radius=5000&latitude=100&longitude=100&access_token=8BY2mPWliL0iMMQeWx

Response Body

{
  "err": {
    "name": "MongoError",
    "message": "n/a",
    "$err": "can't find any special indices: 2d (needs index), 2dsphere (needs index),  for: { loc: { $nearSphere: [ 100, 100 ], $maxDistance: 0.7848061528802386 } }",
    "code": 13038
  },
  "clientMsg": "Couldn't perform search :("
}

Response Headers

{
  "date": "Thu, 25 Jun 2015 14:18:12 GMT",
  "via": "1.1 vegur",
  "etag": "W/\"105-70e1d8a4\"",
  "server": "Cowboy",
  "x-powered-by": "Express",
  "access-control-allow-methods": "*",
  "content-type": "application/json; charset=utf-8",
  "access-control-allow-origin": "*",
  "access-control-expose-headers": "*",
  "connection": "keep-alive",
  "access-control-allow-headers": "*",
  "content-length": "261"
}

Response Code 500
avishaan commented 9 years ago

OHHHH! I was really confused because you said it was responding with unauthorized. We are looking into this now, I think we have a problem with the database on our end.

avishaan commented 9 years ago

This is now fixed. Sorry for the amount of time it took to fix. We thought it was an authorization issue and were looking in the wrong place for the past few days. Let me know if you have any issues with this.

footnote commented 9 years ago

This still responds with unauthorized :(

Response Body

Unauthorized

Response code

401

Response Headers

{
  "date": "Sat, 27 Jun 2015 01:28:43 GMT",
  "via": "1.1 vegur",
  "www-authenticate": "Bearer realm=\"Users\", error=\"invalid_token\"",
  "server": "Cowboy",
  "x-powered-by": "Express",
  "transfer-encoding": "chunked",
  "access-control-allow-methods": "*",
  "access-control-allow-origin": "*",
  "access-control-expose-headers": "*",
  "cache-control": "proxy-revalidate",
  "access-control-allow-headers": "*"
}

Used tokens 8BY2mPWliL0iMMQeWx (Same token that you have provided earlier) 8QgqB7QzKOKTNVBhW1 (Generated token from the application)

screen shot 2015-06-27 at 3 35 42 am

avishaan commented 9 years ago

I did it just now. It is working.

You also need to check the auth token is correct. Before using a token you should always authenticate incase the database has changed. Especially for the dev env.

footnote commented 9 years ago

It just happened again!

Request URL

http://lighttribe-dev.herokuapp.com:80/api/v1/posts?radius=30&latitude=100&longitude=100&access_token=QzjJbPhTeZhWr3F3VZ

Response Body

{
  "err": {
    "name": "MongoError",
    "message": "n/a",
    "$err": "Legacy point is out of bounds for spherical query",
    "code": 17444
  },
  "clientMsg": "Couldn't perform search :("
}

Response Code 500

Response Headers

{
  "date": "Sun, 28 Jun 2015 22:45:08 GMT",
  "via": "1.1 vegur",
  "etag": "W/\"9e-8a2a38cd\"",
  "server": "Cowboy",
  "x-powered-by": "Express",
  "access-control-allow-methods": "*",
  "content-type": "application/json; charset=utf-8",
  "access-control-allow-origin": "*",
  "access-control-expose-headers": "*",
  "connection": "keep-alive",
  "access-control-allow-headers": "*",
  "content-length": "158"
}
footnote commented 9 years ago

screen shot 2015-06-29 at 12 45 49 am

avishaan commented 9 years ago

This is probably because you set latitude as 100 when the maximum value for latitude on any spherical system is 90. Try putting in a value less than 90 or greater than -90. Keep in mind that longitude works the same way except with values between -180 and 180. You will notice this is why uimapkit returns values in those formats.

Sent using CloudMagic [https://cloudmagic.com/k/d/mailapp?ct=pi&cv=6.0.64&pv=8.1.3] On Sun, Jun 28, 2015 at 3:50 PM, footnote.consulting notifications@github.com wrote: screen shot 2015-06-29 at 12 45 49 am [https://cloud.githubusercontent.com/assets/7980253/8398677/cd69ae5e-1df8-11e5-86d4-54f1922749e9.png] [https://cloud.githubusercontent.com/assets/7980253/8398677/cd69ae5e-1df8-11e5-86d4-54f1922749e9.png]

— Reply to this email directly or view it on GitHub [https://github.com/codeHatcher/lightTribe/issues/44#issuecomment-116357001] .[https://github.com/notifications/beacon/AFHNVrOu1hFaCoZn6bYmtPrgxExAbO_jks5oYHGygaJpZM4FCsXK.gif]

footnote commented 9 years ago

We received response body which is good step, however we had Unauthorized and Server Error (401 & 500) errors, which will be listened in the failure! screen shot 2015-06-29 at 1 42 38 am

avishaan commented 9 years ago

I see where the confusion is coming from. You are looking in the incorrect place for the response. The items you are referring to are potential responses that may be sent. Let me know if that makes sense.

Sent using CloudMagic [https://cloudmagic.com/k/d/mailapp?ct=pi&cv=6.0.64&pv=8.1.3] On Sun, Jun 28, 2015 at 4:45 PM, footnote.consulting notifications@github.com wrote: We received response body which is good step, however we had Unauthorized and Server Error (401 & 500) errors, which will be listened in the failure! screen shot 2015-06-29 at 1 42 38 am [https://cloud.githubusercontent.com/assets/7980253/8398871/7108ddc6-1e00-11e5-9fcb-ac1944816659.png] [https://cloud.githubusercontent.com/assets/7980253/8398871/7108ddc6-1e00-11e5-9fcb-ac1944816659.png]

— Reply to this email directly or view it on GitHub [https://github.com/codeHatcher/lightTribe/issues/44#issuecomment-116361144] .[https://github.com/notifications/beacon/AFHNVsh8BEIXbmn9amfARYby9_CQnb6wks5oYH6RgaJpZM4FCsXK.gif]

footnote commented 9 years ago

Solved!