Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems logging in #213

Open
throwoutofcoffeeexception opened this issue May 5, 2019 · 19 comments
Open

Problems logging in #213

throwoutofcoffeeexception opened this issue May 5, 2019 · 19 comments

Comments

@throwoutofcoffeeexception
Copy link

throwoutofcoffeeexception commented May 5, 2019

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
Copy link

cjekel commented May 5, 2019

You can try #211 and let me know if it works

@throwoutofcoffeeexception
Copy link
Author

throwoutofcoffeeexception commented May 5, 2019

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
Copy link

cjekel commented May 5, 2019

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

@throwoutofcoffeeexception
Copy link
Author

throwoutofcoffeeexception commented May 5, 2019

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

@cjekel
Copy link

cjekel commented May 5, 2019

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.

@FavyTeam
Copy link

FavyTeam commented May 9, 2019

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
Copy link

ryan713 commented May 10, 2019

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

@cjekel
Copy link

cjekel commented May 10, 2019

@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
Copy link

ryan713 commented May 10, 2019

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

@FavyTeam
Copy link

FavyTeam commented May 10, 2019

@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
Copy link

darkenedcolossal commented Jun 10, 2019

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
Copy link

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

@darkenedcolossal
Copy link

LOL, how can I invalidate it? :D

@darkenedcolossal
Copy link

darkenedcolossal commented Jun 10, 2019

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

@oncleguigs
Copy link

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
Copy link

cjekel commented Jun 18, 2019

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
Copy link

darkenedcolossal commented Jun 18, 2019

@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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants