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

Authorization bug #7

Closed
robpot891 opened this issue May 2, 2019 · 8 comments
Closed

Authorization bug #7

robpot891 opened this issue May 2, 2019 · 8 comments

Comments

@robpot891
Copy link

Error message:
(cv) silas@silas:~/my_tinder_data$ tindetheus browse Traceback (most recent call last): File "/home/silas/.virtualenvs/cv/bin/tindetheus", line 10, in <module> sys.exit(command_line_run()) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 733, in command_line_run main(args, defaults['facebook_token']) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 551, in main likes_left=args.likes) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 314, in __init__ self.session = self.login(facebook_token) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 349, in login session = pynder.Session(facebook_token) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/pynder/session.py", line 18, in __init__ self._api.auth(facebook_id, facebook_token) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/pynder/api.py", line 28, in auth self._full_url('/auth'), json=data, proxies=self._proxies).json() File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Seems to be an issue with improperly formatted json data. Do you have any insight into how I can fix this? Thanks

@cjekel
Copy link
Owner

cjekel commented May 2, 2019

Can you try this pynder build charliewolf/pynder#211 and let me know if it works?

git clone git@github.com:cjekel/pynder.git
cd pynder
git checkout v2auth_newhead
pip install . --force-reinstall --no-deps

@robpot891
Copy link
Author

I followed your instructions and installed your updated pynder and got the same error message:

Traceback (most recent call last): File "/home/silas/.virtualenvs/cv/bin/tindetheus", line 10, in <module> sys.exit(command_line_run()) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 733, in command_line_run main(args, defaults['facebook_token']) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 551, in main likes_left=args.likes) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 314, in __init__ self.session = self.login(facebook_token) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 349, in login session = pynder.Session(facebook_token) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/pynder/session.py", line 18, in __init__ self._api.auth(facebook_id, facebook_token) File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/pynder/api.py", line 28, in auth self._full_url('/auth'), json=data, proxies=self._proxies).json() File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Is the Facebook auth token supposed to be 200+ characters long? Mine is and maybe I've gotten the facebook auth and facebook ID mixed up?

@cjekel
Copy link
Owner

cjekel commented May 2, 2019

I don't think my version of pynder installed in your cv environment, because the line that is throwing the error has been changed in the new code. I also changed how the error is shown when authenticating.

Try running

python -m pip install . --force-reinstall --no-deps

from the pynder folder within your cv environment. That will make sure the right pip is used.

Yes the facebook token is > 200 characters. The facebook ID isn't needed any more.

@robpot891
Copy link
Author

Thanks for helping me out. This is the latest error message after making sure I installed the new pynder.

Traceback (most recent call last):
File "/home/silas/.virtualenvs/cv/bin/tindetheus", line 10, in
sys.exit(command_line_run())
File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 733, in command_line_run
main(args, defaults['facebook_token'])
File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 551, in main
likes_left=args.likes)
File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 314, in init
self.session = self.login(facebook_token)
File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/tindetheus/tindetheus.py", line 349, in login
session = pynder.Session(facebook_token)
File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/pynder/session.py", line 18, in init
self._api.auth(facebook_id, facebook_token)
File "/home/silas/.virtualenvs/cv/lib/python3.6/site-packages/pynder/api.py", line 41, in auth
raise errors.RequestError(err)
pynder.errors.RequestError: Couldn't authenticate request status code: 401

My internet is working fine and I'm able to login to Tinder and Facebook through browser.

@cjekel
Copy link
Owner

cjekel commented May 3, 2019

Strange, this is the same unauthorized access error getting thrown in travis ci build... but this fork of pynder is working for me.

Someone mentioned fbessez/Tinder#69 that the new auth didn't work, and the old auth gave an okay. Also someone in charliewolf/pynder#208 was having issues with the new auth. So let me tag these issues to see if someone else can figure out what is going on...

Let's try the following ant see what happens.

Can you run this in a python/ipython console and see what happens?

Old Auth

import requests

facebook_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

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

old_url = 'https://api.gotinder.com/auth'

old_data = {"facebook_token": facebook_token}

r_old = requests.post(old_url, headers=HEADERS, json=old_data)

print(r_old.status_code)
print(r_old.json())
                        

New auth

import requests

facebook_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

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

new_url = 'https://api.gotinder.com/v2/auth/login/facebook'

new_data = {"token": facebook_token}

r_new = requests.post(new_url, headers=HEADERS, json=new_data)

print(r_new.status_code)
print(r_new.json())

In my case

Old auth outputs:

200

/usr/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
    895                     # used.
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 
    899     @property

/usr/lib64/python3.6/site-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
    516             parse_constant is None and object_pairs_hook is None
    517             and not use_decimal and not kw):
--> 518         return _default_decoder.decode(s)
    519     if cls is None:
    520         cls = JSONDecoder

/usr/lib64/python3.6/site-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
    368         if _PY3 and isinstance(s, binary_type):
    369             s = s.decode(self.encoding)
--> 370         obj, end = self.raw_decode(s)
    371         end = _w(s, end).end()
    372         if end != len(s):

/usr/lib64/python3.6/site-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
    398             elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
    399                 idx += 3
--> 400         return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

but New Auth outputs:

200
{'meta': {'status': 200}, 'data': {'_id': 'xxxxx', 'api_token': 'xxxxxxx', 'refresh_token': 'xxxxxxx', 'is_new_user': False}}

where 'api_token' is my X-Auth-Token


Please don't share any private data. I marked my data with xxxx

Notice how both authentications throw the 200 api okay code, but only one is throwing my api token in json. I don't know what's going on, but this is what I used to troubleshoot before sending my pr.

@robpot891
Copy link
Author

JSONDecodeError                           Traceback (most recent call last)
<ipython-input-4-28f361214497> in <module>()
     20 
     21 print(r_old.status_code)
---> 22 print(r_old.json())
     23 

~/.virtualenvs/cv/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
    895                     # used.
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 
    899     @property

/usr/lib/python3/dist-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
    516             parse_constant is None and object_pairs_hook is None
    517             and not use_decimal and not kw):
--> 518         return _default_decoder.decode(s)
    519     if cls is None:
    520         cls = JSONDecoder

/usr/lib/python3/dist-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
    368         if _PY3 and isinstance(s, binary_type):
    369             s = s.decode(self.encoding)
--> 370         obj, end = self.raw_decode(s)
    371         end = _w(s, end).end()
    372         if end != len(s):

/usr/lib/python3/dist-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
    398             elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
    399                 idx += 3
--> 400         return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This is the first one.

The second one worked!

200
{'meta': {'status': 200}, 'data': {'_id': 'XXXXXXXX', 'api_token': 'XXXXXXXXXXX', 'refresh_token': 'XXX.XXXXXX', 'is_new_user': False}}

@robpot891 robpot891 changed the title Se Authorization bug May 3, 2019
@robpot891
Copy link
Author

Update

I got it working now. The only thing I did differently was clone the repo and install it manually with setup.py.

Awesome program too. Works perfectly. Cheers.

@cjekel
Copy link
Owner

cjekel commented May 3, 2019

I'm glad you got it working. A few days ago I changed how the config.txt file was being read 0b027e1 which was likely causing the 401.

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

2 participants