Doing the OAuth dance with style using Flask, requests, and oauthlib. Check out just how easy it can be to hook up your Flask app with OAuth:

from flask import Flask, redirect, url_for
from flask_dance.contrib.github import make_github_blueprint, github

app = Flask(__name__)
app.secret_key = "supersekrit"  # Replace this with your own secret!
blueprint = make_github_blueprint(
app.register_blueprint(blueprint, url_prefix="/login")

def index():
    if not github.authorized:
        return redirect(url_for("github.login"))
    resp = github.get("/user")
    assert resp.ok
    return "You are @{login} on GitHub".format(login=resp.json()["login"])

Ready to get started?

User Guide

Options & Configuration

Advanced Topics

Indices and tables