Question

With Flask-OpenID there's a really nice OpenID module for the Flask framework. However, facebook only supports FBconnect and no real OpenID.

I'm looking for a modified version of Flask-OpenID (if one exists) which supports FBconnect or a library doing FBconnect authentication in a similar way as Flask-OpenID.

Was it helpful?

Solution

The Flask-OAuth extension supports Facebook authentication:

facebook = oauth.remote_app('facebook',
    base_url='https://graph.facebook.com/',
    request_token_url=None,
    access_token_url='/oauth/access_token',
    authorize_url='https://www.facebook.com/dialog/oauth',
    consumer_key=FACEBOOK_APP_ID,
    consumer_secret=FACEBOOK_APP_SECRET,
    request_token_params={'scope': 'email'}
)

Here's a full Facebook example: https://github.com/mitsuhiko/flask-oauth/blob/master/example/facebook.py

OTHER TIPS

You might also want to checkout Flask-Social as well (which is an extension on top of Flask-Security). I'm in the middle of setting it up myself, but so far no issues. Flask-Security, if you're not familiar, combines Flask-Login, Flask-Principal, and a few other extensions for a quick security layer, and Flask-Social adds the OAuth features.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top