pynder icon indicating copy to clipboard operation
pynder copied to clipboard

Problems logging in

Open throwoutofcoffeeexception opened this issue 5 years ago • 19 comments

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?

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

cjekel avatar May 05 '19 14:05 cjekel

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)

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

cjekel avatar May 05 '19 19:05 cjekel

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

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.

cjekel avatar May 05 '19 23:05 cjekel

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!

FavyTeam avatar May 09 '19 22:05 FavyTeam

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

ryan713 avatar May 10 '19 16:05 ryan713

@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.

cjekel avatar May 10 '19 16:05 cjekel

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

ryan713 avatar May 10 '19 16:05 ryan713

@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!

FavyTeam avatar May 10 '19 17:05 FavyTeam

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'})

darkenedcolossal avatar Jun 10 '19 00:06 darkenedcolossal

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

BenWhiteJam avatar Jun 10 '19 11:06 BenWhiteJam

LOL, how can I invalidate it? :D

darkenedcolossal avatar Jun 10 '19 16:06 darkenedcolossal

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

darkenedcolossal avatar Jun 10 '19 16:06 darkenedcolossal

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?

oncleguigs avatar Jun 18 '19 17:06 oncleguigs

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'
}

cjekel avatar Jun 18 '19 18:06 cjekel

@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.

darkenedcolossal avatar Jun 18 '19 19:06 darkenedcolossal

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. :)

patrickclery avatar Jun 21 '19 08:06 patrickclery

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.

RMatushkin avatar Jul 24 '20 22:07 RMatushkin