Skip to content

Access token could not be retrieved  #148

Open
@jsdjsd

Description

@jsdjsd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions