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