-
Notifications
You must be signed in to change notification settings - Fork 141
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
How to get Facebook Access Token and Facebook ID #171
Comments
Is Tinder to blame for ssl error?? any idea? |
@gragragrao I have a script used to get the access token. It requires Robobrowser.
It's been a while since I last used it so it may no longer work. |
Does this still work? |
It works if you run pkillnine code, but you also have to add "import re" and so correct code should look like this (2018 October): import robobrowser
import re
MOBILE_USER_AGENT = r"Mozilla/5.0 (Linux; U; en-gb; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.16 Safari/535.19"
FB_AUTH = "https://m.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fauthorize%2F&display=touch&state=%7B%22challenge%22%3A%22IUUkEUqIGud332lfu%252BMJhxL4Wlc%253D%22%2C%220_auth_logger_id%22%3A%2230F06532-A1B9-4B10-BB28-B29956C71AB1%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&scope=user_birthday%2Cuser_photos%2Cuser_education_history%2Cemail%2Cuser_relationship_details%2Cuser_friends%2Cuser_work_history%2Cuser_likes&response_type=token%2Csigned_request&default_audience=friends&return_scopes=true&auth_type=rerequest&client_id=464891386855067&ret=login&sdk=ios&logger_id=30F06532-A1B9-4B10-BB28-B29956C71AB1&ext=1470840777&hash=AeZqkIcf-NEW6vBd"
def get_access_token(email, password):
s = robobrowser.RoboBrowser(user_agent=MOBILE_USER_AGENT, parser="lxml")
s.open(FB_AUTH)
f = s.get_form()
f["pass"] = password
f["email"] = email
s.submit_form(f)
f = s.get_form()
if f.submit_fields.get('__CONFIRM__'):
s.submit_form(f, submit=f.submit_fields['__CONFIRM__'])
else:
raise Exception("Couldn't find the continue button. Maybe you supplied the wrong login credentials? Or maybe Facebook is asking a security question?")
access_token = re.search(r"access_token=([\w\d]+)", s.response.content.decode()).groups()[0]
return access_token
get_access_token("yourFB@email", "yourFB_password") #This is not really safe as you will have your email and password locally visible on your pc After you have access token you can get your facebook_id from this site: |
@robertmielewczyk Getting this now:
Any ideas? |
For now I will leave a manual way of getting this token and soon I will upload a python version. Getting Access_Token Manual Way: (Thanks to 'fbessez' comment) STEPS:
Once you have your token you can start playing with tinder API To quick start anyone to see if the api is working with the token here's an authorization call: curl -X POST https://api.gotinder.com/auth -H "Content-Type: application/json" -d '{
"facebook_token":"asdklnalnwlknqyeahthosearerandomletters",
"facebook_id":"ActuallyAnythingButYouCanPutYourIdHere"
}' |
working perfectly! Thank you very much |
Guys! I think our issue is related to the User Agent string. Not sure why/how, but on my side i just switched it to Safari (most recent) and used the facebook desktop link. Tweaked the original code: import robobrowser
import re
class UserAgent:
class Mobile:
class iOS:
safari = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A356 Safari/604.1'
class Facebook:
AUTHAPP_FORM_ACTION = '/v2.8/dialog/oauth/confirm'
AUTH_URL = "https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fauthorize%2F&display=touch&state=%7B%22challenge%22%3A%22IUUkEUqIGud332lfu%252BMJhxL4Wlc%253D%22%2C%220_auth_logger_id%22%3A%2230F06532-A1B9-4B10-BB28-B29956C71AB1%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&scope=user_birthday%2Cuser_photos%2Cuser_education_history%2Cemail%2Cuser_relationship_details%2Cuser_friends%2Cuser_work_history%2Cuser_likes&response_type=token%2Csigned_request&default_audience=friends&return_scopes=true&auth_type=rerequest&client_id=464891386855067&ret=login&sdk=ios&logger_id=30F06532-A1B9-4B10-BB28-B29956C71AB1&ext=1470840777&hash=AeZqkIcf-NEW6vBd"
def __init__(self, username, password, user_agent=None):
self.username = username
self.password = password
self.user_agent = user_agent
if not self.user_agent:
self.user_agent = UserAgent.Mobile.iOS.safari
self.browser = robobrowser.RoboBrowser(user_agent=self.user_agent, parser="lxml")
def get_access_token(self):
self.browser.open(self.AUTH_URL)
# Authentication
login_form = self.browser.get_form()
login_form["pass"] = self.password
login_form["email"] = self.username
self.browser.submit_form(login_form)
# Authorizing App
authapp_form = self.browser.get_form(action=self.AUTHAPP_FORM_ACTION)
if authapp_form.submit_fields.get('__CONFIRM__'):
self.browser.submit_form(authapp_form, submit=authapp_form.submit_fields['__CONFIRM__'])
else:
raise Exception("Couldn't find the continue button. Maybe you supplied the wrong login credentials? Or maybe Facebook is asking a security question?")
self.access_token = re.search(r"access_token=([\w\d]+)", self.browser.response.content.decode()).groups()[0]
return self.access_token
if __name__ == '__main__':
username = 'your@email.com'
password = 'yourpassword'
facebook = Facebook(username, password)
print facebook.get_access_token() Hope it will work for you guys as well! Let's get back on the Tinder game XD |
@vyscond |
@dhrumin75 Did you tried opening up the facebook link on your browser to check if the page is loading properly? |
@vyscond the page opens with a tinder dialog box but the 'Continue' or 'OK' buttons are not showing up. Just a plain Dialog box. Here's the screenshot |
@dhrumin75 Weird. Try render it as mobile browser. |
@vyscond well this worked, Thank you! |
Hi, sorry to repeat an previously asked question, but I can't pass the facebook authentication; following error always occurs.
I want to know the detail way to get facebook id and facebook access token.
Anything will be helpful.
The text was updated successfully, but these errors were encountered: