charliewolf / pynder

:fire: Python client for tinder api
Other
638 stars 142 forks source link

Problems logging in #213

Open throwoutofcoffeeexception opened 5 years ago

throwoutofcoffeeexception commented 5 years ago

Hello does this library still work. I always have problems to log in. I am getting an 400 error with this code:

import pynder
import itertools
FBID = ...
FBTOKEN =  "..."

session = pynder.Session(FBID, FBTOKEN)
users = session.nearby_users()
for user in itertools.islice(users, 5):
    print(user.name())

Does somebody have code that is working?

cjekel commented 5 years ago

You can try https://github.com/charliewolf/pynder/pull/211 and let me know if it works

throwoutofcoffeeexception commented 5 years ago

I can get a tinder Auth token, but still get a 400 error with this code:

import pynder X_Auth_Token = '...' session = pynder.Session(XAuthToken=X_Auth_Token) print(session.profile)

cjekel commented 5 years ago

Just to clarify. With #211 version installed you get the 400 error?

throwoutofcoffeeexception commented 5 years ago

Okay, my mistake. I forgot the python -m pip install . --force-reinstall --no-deps

cjekel commented 5 years ago

Just to manually throw requests to the api https://github.com/fbessez/Tinder and see if you can get something other than a 400. If you're able to login and get X-Auth-Token, I'm not sure why you get a 400 with other calls.

So I would get my XAuthToken using https://github.com/cjekel/tindetheus/issues/7#issuecomment-488878534, or however you did before.

Then manually send a request using

import requests
USER_AGENT = "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)"

HEADERS = {
    'app_version': '6.9.4',
    'platform': 'ios',
    "content-type": "application/json",
    "User-agent": USER_AGENT,
    "Accept": "application/json"
}
url_profile = 'https://api.gotinder.com/profile'
HEADERS['X-Auth-Token'] = 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
r = requests.get(url_profile, headers=HEADERS)
print(r)
print(r.json)

but again if this throws a 400, I'm not sure what you can do.

FavyTeam commented 5 years ago

Hi @cjekel

Tinder login is not working again. I just look at your new auth tinder api and it was worked perfectly. But now it's not working again. I got this error

{ "meta": { "status": 400 }, "error": { "code": 40006, "message": "Invalid request body" } }

Please let me know if you know something.

Thanks!

ryan713 commented 5 years ago

@throwoutofcoffeeexception did you get it working? I'm still getting the exception 400.

cjekel commented 5 years ago

@FavyTeam I don't know how to help with the 400. My PR and new auth is working for me right now. I'm using requests.__version__ == 2.22.0.

ryan713 commented 5 years ago

@cjekel is the #211 build working for you with XAuth?

FavyTeam commented 5 years ago

@cjekel Just test it using Postmon on my local and I got same errors.

I don't know why it's not working and why they say it is Invalid request body... Previously, To be honest, Until Apr 30th It's working perfectly.

I also generate new access_token and use it.

Is there any fields added on Auth API?

{ "meta": { "status": 401 }, "error": { "code": 60001 } }

This error occurred!

darkenedcolossal commented 5 years ago

Just to manually throw requests to the api https://github.com/fbessez/Tinder and see if you can get something other than a 400. If you're able to login and get X-Auth-Token, I'm not sure why you get a 400 with other calls.

So I would get my XAuthToken using cjekel/tindetheus#7 (comment), or however you did before.

Then manually send a request using

import requests
USER_AGENT = "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)"

HEADERS = {
    'app_version': '6.9.4',
    'platform': 'ios',
    "content-type": "application/json",
    "User-agent": USER_AGENT,
    "Accept": "application/json"
}
url_profile = 'https://api.gotinder.com/profile'
HEADERS['X-Auth-Token'] = 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
r = requests.get(url_profile, headers=HEADERS)
print(r)
print(r.json)

but again if this throws a 400, I'm not sure what you can do.

This works for me. (HTTP 200)

What also works (HTTP 200)

import requests
requests.Session().request(method="get",url='https://api.gotinder.com/profile',headers={'X-Auth-Token': 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'})

or

import requests
s = requests.Session()
s.headers.update({'X-Auth-Token': '2df4e55e-ff7f-4567-aa12-621051d98901'})
s.request(method="get",url='https://api.gotinder.com/profile')

What does not work (HTTP 400)

import pynder
session = pynder.Session(XAuthToken='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx')
session._api._session.request(method="get",url='https://api.gotinder.com/profile',headers={'X-Auth-Token': 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'})
BenWhiteJam commented 5 years ago

@darkenedcolossal I guess you just committed your X-Auth-Token: s.headers.update({'X-Auth-Token': '2df4e55e-ff7f-4567-aa12-621051d98901'})

darkenedcolossal commented 5 years ago

LOL, how can I invalidate it? :D

darkenedcolossal commented 5 years ago

@BenWhiteJam THX!!! Haha, ok I think I invalidated it now by logging out. :D

oncleguigs commented 5 years ago

Just to manually throw requests to the api https://github.com/fbessez/Tinder and see if you can get something other than a 400. If you're able to login and get X-Auth-Token, I'm not sure why you get a 400 with other calls. So I would get my XAuthToken using cjekel/tindetheus#7 (comment), or however you did before. Then manually send a request using

import requests
USER_AGENT = "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)"

HEADERS = {
    'app_version': '6.9.4',
    'platform': 'ios',
    "content-type": "application/json",
    "User-agent": USER_AGENT,
    "Accept": "application/json"
}
url_profile = 'https://api.gotinder.com/profile'
HEADERS['X-Auth-Token'] = 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
r = requests.get(url_profile, headers=HEADERS)
print(r)
print(r.json)

but again if this throws a 400, I'm not sure what you can do.

This works for me. (HTTP 200)

What also works (HTTP 200)

import requests
requests.Session().request(method="get",url='https://api.gotinder.com/profile',headers={'X-Auth-Token': 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'})

or

import requests
s = requests.Session()
s.headers.update({'X-Auth-Token': '2df4e55e-ff7f-4567-aa12-621051d98901'})
s.request(method="get",url='https://api.gotinder.com/profile')

What does not work (HTTP 400)

import pynder
session = pynder.Session(XAuthToken='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx')
session._api._session.request(method="get",url='https://api.gotinder.com/profile',headers={'X-Auth-Token': 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'})

Same for me, the request is working fine with the Xauth token (200), but I still get error HTTP 400 with the pynder session.

Does anyone has a fix to this?

cjekel commented 5 years ago
import pynder
session = pynder.Session(XAuthToken='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx')
session._api._session.request(method="get",url='https://api.gotinder.com/profile',
                              headers={'X-Auth-Token': 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'})

@darkenedcolossal You override the correct headers when you do this. Your headers should be something like this

HEADERS = {
    'app_version': '6.9.4',
    'platform': 'ios',
    "content-type": "application/json",
    "User-agent": "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)",
    "Accept": "application/json",
    "XAuthToken": 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
}
darkenedcolossal commented 5 years ago

@oncleguigs

Same for me, the request is working fine with the Xauth token (200), but I still get error HTTP 400 with the pynder session.

Does anyone has a fix to this?

This worked for me:

diff --git a/pynder/api.py b/pynder/api.py
index ecb9de0..19c8e5a 100644
--- a/pynder/api.py
+++ b/pynder/api.py
@@ -32,7 +32,7 @@ class TinderAPI(object):
         self._session.headers.update({"X-Auth-Token": str(result['token'])})
         return result

-    def _request(self, method, url, data={}):
+    def _request(self, method, url, data=None):
         if not hasattr(self, '_token'):
             raise errors.InitializationError
         result = self._session.request(method, self._full_url(
diff --git a/pynder/constants.py b/pynder/constants.py
index 036ecce..ee1c042 100644
--- a/pynder/constants.py
+++ b/pynder/constants.py
@@ -8,7 +8,6 @@ USER_AGENT = 'Tinder Android Version 6.4.1'
 HEADERS = {
     "Content-Type": "application/json; charset=utf-8",
     "User-Agent": USER_AGENT,
-    "Host": API_BASE,
     "os_version": "1935",
     "app-version": "371",
     "platform": "android",  # XXX with ios we run in an error

@cjekel

import pynder
session = pynder.Session(XAuthToken='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx')
session._api._session.request(method="get",url='https://api.gotinder.com/profile',
                              headers={'X-Auth-Token': 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'})

@darkenedcolossal You override the correct headers when you do this. Your headers should be something like this

HEADERS = {
    'app_version': '6.9.4',
    'platform': 'ios',
    "content-type": "application/json",
    "User-agent": "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)",
    "Accept": "application/json",
    "XAuthToken": 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
}

Actually I did not need these headers to get pynder working for me. Neccessary were the above changes, but removing all headers but xauth token did not seen to hurt.

patrickclery commented 5 years ago

Solved.

Although I'm using my own Tinder client written in Ruby, I've verified that using any Content-Type header other than Content-Type: application/json will return "Invalid request body".

Even though /auth/sms/send and /auth/sms/validate (or the Facebook equivalent) aren't affected, it looks like the /auth/login/sms endpoint requires content-type application/json.

Thought I'd share. :)

RMatushkin commented 4 years ago

Who wants to sniff Tinder API of the latest official app (v3 api version), you can write to me and I'll explain how to do it.