alkawryk / tinderbot

Platform for developing bots for the Tinder dating app
139 stars 33 forks source link

Getting 403 from authorization #4

Closed stevenirby closed 10 years ago

stevenirby commented 10 years ago

I'm now getting a 403 when tinderbot tries to authorize.

<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>openresty/1.5.8.1</center>
</body>
</html>

Also, no error is getting thrown because body is just the html and there is no error property.

  this.authorize = function(fbToken, fbId, callback) {
    tinderPost('auth',
      {
        facebook_token: fbToken,
        facebook_id: fbId
      },
      function(error, res, body) {
        if (!error && body.token) {
          xAuthToken = body.token;
          _this.userId = body.user._id;
          callback();
        } else if (body.error){
          throw "Failed to authenticate: " + body.error
        }
      });
  };

I'm not really sure what's going on, but an error should probably be thrown, that the authorization didn't succeed.

stevenirby commented 10 years ago

I opened a pull req in tinderjs for this. Looks like it just needs more info in the header.

https://github.com/alkawryk/tinderjs/pull/6

alkawryk commented 10 years ago

Just merged https://github.com/alkawryk/tinderjs/pull/6 . Thanks!