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

Facebook ID and Facebook access token #136

Open
xairy opened this issue Mar 4, 2017 · 10 comments
Open

Facebook ID and Facebook access token #136

xairy opened this issue Mar 4, 2017 · 10 comments

Comments

@xairy
Copy link

xairy commented Mar 4, 2017

Please add instructions for getting Facebook ID and Facebook access token.

I can find a whole bunch of different tokens on https://developers.facebook.com (user token, app token, app secret, ...), but I have no idea which one I need.

@kpolucas
Copy link

kpolucas commented Mar 8, 2017

The facebook ID:
I get it from http://findmyfbid.com/ is unique and never change

The token:
Dont remember where i get this function (god bless whoever code it)

import robobrowser
import re

MOBILE_USER_AGENT = "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://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 get_access_token(email, password):
    s = robobrowser.RoboBrowser(user_agent=MOBILE_USER_AGENT, parser="lxml")
    s.open(FB_AUTH)
    ##submit login form##
    f = s.get_form()
    f["pass"] = password
    f["email"] = email
    s.submit_form(f)
    ##click the 'ok' button on the dialog informing you that you have already authenticated with the Tinder app##
    f = s.get_form()
    s.submit_form(f, submit=f.submit_fields['__CONFIRM__'])
    ##get access token from the html response##
    access_token = re.search(r"access_token=([\w\d]+)", s.response.content.decode()).groups()[0]

    return access_token

@heath3n
Copy link

heath3n commented May 2, 2017

If you don't need to get it programmatically, you can simply spawn the Tinder auth dialog here and copy the token from the response you get when you click OK.

@brenly
Copy link

brenly commented Jun 23, 2017

I believe I am using the authentication script correctly with Python 3.6 but I am still getting 401 error messages in my experiments

Edit: Resolved. I was not using positional arguments in function header/ calls.
The browser script was not the issue.

@bryanmorganoverbey
Copy link

@brenly can you describe how you resolved this? I also get 401 error

@brenly
Copy link

brenly commented Aug 11, 2018

It's been a bit. I will have to look back over my code. If you research the different ways to do arguments in function calls in python you will find my solution quicker than i can get back to you. Good luck and I'll try to get back to you!

@chen-bill
Copy link

chen-bill commented Aug 17, 2018

To add on to brenly's comment, you should be creating your session object like this:

session = pynder.Session(facebook_id=FACEBOOK_ID, facebook_token=get_access_token(email, password))

where the get_access_token function is the one mentioned by kpolucas

@ghost
Copy link

ghost commented Dec 2, 2018

This function is now throwing:

  File "/Volumes/gizmo/Development/Sources/tinder-bot/env/lib/python2.7/site-packages/requests/sessions.py", line 140, in resolve_redirects
    raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects, response=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.

:(

@bryanmorganoverbey
Copy link

@vyscond yeah I was getting this error last night too. Looks to do with facebook authentication.

@josecoves
Copy link

I was able to get the FBTOKEN manually from here https://gist.github.com/taseppa/66fc7239c66ef285ecb28b400b556938

@ghost
Copy link

ghost commented Dec 8, 2018

Posted a solution on #171

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

7 participants