Authlib Loginpass

repository·master·Indexed 43 days ago

https://github.com/authlib/loginpass

A high-level library for implementing social logins with pre-configured OAuth and OpenID Connect provider connections. It provides standardized user profiles and integrates with frameworks like Flask and Django. Requires Authlib v0.14.3+.

Tokens
669
Snippets
1
Records
5
Agent score
6%

What's inside Authlib Loginpass

  1. Integrate social login with Flask using Loginpass

    master

    Authlib Loginpass provides a high-level wrapper around Authlib to simplify social connections in Flask and Django applications. To use it with Flask, you need to:

    1. Initialize your Flask app and an OAuth instance.
    2. Define a callback function (handle_authorize) that processes the remote provider, the token, and the user_info.
    3. Select your desired backends (e.g., Twitter, GitHub, Google).
    4. Create a blueprint using create_flask_blueprint and register it with your app.

    Note: This library works best with Authlib v0.14.3+.

    from flask import Flask
    from authlib.integrations.flask_client import OAuth
    from loginpass import create_flask_blueprint
    from loginpass import Twitter, GitHub, Google
    
    app = Flask(__name__)
    oauth = OAuth(app)
    
    def handle_authorize(remote, token, user_info):
        if token:
            save_token(remote.name, token)
        if user_info:
            save_user(user_info)
            return user_page
        raise some_error
    
    backends = [Twitter, GitHub, Google]
    bp = create_flask_blueprint(backends, oauth, handle_authorize)
    app.register_blueprint(bp, url_prefix='')
  2. Supported social connections in Loginpass

    master

    Loginpass supports OAuth 1, OAuth 2, and OpenID Connect for a wide variety of providers. The following connections are currently available:

    • Battle.net
    • Google
    • GitHub
    • Gitlab
    • Twitter
    • Facebook
    • Dropbox
    • Reddit
    • Linkedin
    • Azure
    • Discord
    • Slack
    • StackOverflow
    • Bitbucket
    • Auth0
    • Strava
    • Spotify
    • Yandex
    • Twitch
    • VK
    • Ory Hydra