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

Access token could not be retrieved #148

Open
jsdjsd opened this issue Aug 4, 2022 · 0 comments
Open

Access token could not be retrieved #148

jsdjsd opened this issue Aug 4, 2022 · 0 comments

Comments

@jsdjsd
Copy link

jsdjsd commented Aug 4, 2022

Hello all,

I think the code is not working anymore, probably a change in the last few months on fb side....

I believe the URL should work, maybe the issue is on the MOBILE_USER_AGENT ?

The error message isn't helpful : FB_AUTH_TOKEN = {'error': 'access token could not be retrieved. Check your username and password.'} I did check that both the username and password are fine of course !

Is it working still for everyone else ?

I am using the following code :

import re
import robobrowser
import requests
MOBILE_USER_AGENT = "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)"

def get_access_token(email, password):
s = robobrowser.RoboBrowser(user_agent=MOBILE_USER_AGENT, parser="lxml")
s.open(FB_AUTH)
f = s.get_form()
s.submit_form(f)
f = s.get_form()
f["pass"] = password
f["email"] = email
s.submit_form(f)
f = s.get_form()
try:
s.submit_form(f, submit=f.submit_fields['CONFIRM'])
access_token = re.search(
r"access_token=([\w\d]+)", s.response.content.decode()).groups()[0]
return access_token
except requests.exceptions.InvalidSchema as browserAddress:
access_token = re.search(
r"access_token=([\w\d]+)",str(browserAddress)).groups()[0]
return access_token
except Exception as ex:
print("access token could not be retrieved. Check your username and password.")
print("Official error: %s" % ex)
return {"error": "access token could not be retrieved. Check your username and password."}

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

1 participant