skillfed

Flask-Dance

Doing the OAuth dance with style using Flask, requests, and oauthlib

flask-dance v7.1.0 1.2M downloads/30d#4,175 on PyPI1,012
Permissive license DORMANT released

What it is and what it does

Flask-Dance is a Flask extension that abstracts the OAuth consumer flow, letting you add OAuth-based login to your application with minimal boilerplate. It wraps requests, oauthlib, and requests-oauthlib to handle token exchange, refresh, and storage transparently. The package provides pre-configured blueprints for popular providers and a flexible API for custom providers.

By default, tokens are stored in Flask's session, but the package supports pluggable storage backends—most commonly SQLAlchemy for persistent database storage. This prevents users from losing authentication when clearing browser cookies. The library integrates with Flask-SQLAlchemy, Flask-Login, and Flask-Caching, making it a natural fit for larger Flask applications that already use those extensions.

Use it for:

  • Add OAuth login to a Flask app without writing OAuth flow code from scratch.
  • Implement persistent OAuth token storage in a database using the SQLAlchemy backend.
  • Support multiple OAuth providers in a single Flask application.
  • Integrate OAuth authentication with Flask-Login for user session management.
  • Build a custom OAuth integration for a non-standard provider using the flexible API.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Flask-Dance simplifies OAuth authentication in Flask applications by providing pre-built integrations with multiple OAuth providers and handling the token exchange flow automatically.

Yes, for stable OAuth authentication needs in Flask apps. The package is mature, well-documented, and carries no known vulnerabilities. Dormant maintenance is acceptable here because OAuth flows are standardized and unlikely to require frequent updates. Install it if you need straightforward OAuth integration; avoid it only if you require active upstream development or support for very recent OAuth extensions.

Install

flask-dance on PyPI

pip

pip install flask-dance

uv

uv add flask-dance

poetry

poetry add flask-dance

Installing Flask-Dance

Before you install

Low friction installation with a pure-Python wheel. Maintenance is dormant—last release was in March 2024—but the repository remains active with recent commits and no archived status. Suitable for stable use cases where OAuth integration doesn't need active development.

License in practice

Licensed under MIT (permissive), allowing unrestricted use, modification, and distribution in both open-source and commercial projects.

Quickstart

pip install Flask-Dance

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

app = Flask(__name__)
app.secret_key = "your-secret-key"
blueprint = make_github_blueprint(client_id="id", client_secret="secret")
app.register_blueprint(blueprint, url_prefix="/login")

if github.authorized:
    resp = github.get("/user")
    print(resp.json())

Requires Flask app configuration with a secret key and OAuth provider credentials (client_id and client_secret).

Verify before relying

  • Whether the list of supported OAuth providers remains current given the dormant maintenance status.
  • Performance characteristics when handling high-volume token storage and refresh scenarios.
  • Compatibility with recent Flask and Werkzeug major versions beyond Python 3.7, 3.8, 3.9, 3.10.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 6 — requests, oauthlib, requests-oauthlib, Flask, Werkzeug, urlobject
Maintenance dormant — 892 days since the last release
Last repo commit
First released
Downloads 1,235,885/month — #4,175 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flask_dance-7.1.0-py3-none-any.whl

Framework :: FlaskFramework :: PytestLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

flask oauth authenticationoauth provider integrationflask login with githuboauth token managementflask oauth consumersocial login flaskoauth blueprint flask
oauth-consumerflask-extensionauthentication

More Dynamic Content packages