# Flask-Dance

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(
        client_id="my-key-here",
        client_secret="my-secret-here",
    )
    app.register_blueprint(blueprint, url_prefix="/login")

    @app.route("/")
    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

- Installation
- Quickstart
- Concepts
- Understanding the Magic
- Multi-User Setups
- Logging Out
- Projects Using Flask-Dance

## Options & Configuration

- Providers
  - Atlassian
  - Authentiq
  - Azure
  - Dexcom
  - Digital Ocean
  - Discord
  - Dropbox
  - Facebook
  - Fitbit
  - GitHub
  - GitLab
  - Google
  - Heroku
  - JIRA
  - LinkedIn
  - Meetup
  - Nylas
  - OpenStreetMap
  - ORCID
  - Reddit
  - Salesforce
  - Slack
  - Strava
  - Twitch
  - Spotify
  - Zoho
  - Custom
- Token Storages
  - Flask Session
  - SQLAlchemy
  - Custom
- Signals
  - `oauth_before_login`
  - `oauth_authorized`
  - `oauth_error`

## Advanced Topics

- How OAuth Works
  - Definitions
  - OAuth 2
  - OAuth 1
  - Dance Complete
- Proxies and HTTPS
- Testing Apps That Use Flask-Dance
  - Mock Storages
    - `NullStorage`
    - `MemoryStorage`
  - Mock API Responses
  - Provided Pytest Fixture
- Developer Interface
  - Consumers
    - `OAuth1ConsumerBlueprint`
      - `OAuth1ConsumerBlueprint.__init__()`
      - `OAuth1ConsumerBlueprint.session`
      - `OAuth1ConsumerBlueprint.storage`
      - `OAuth1ConsumerBlueprint.token`
      - `OAuth1ConsumerBlueprint.config`
      - `OAuth1ConsumerBlueprint.from_config`
    - `OAuth2ConsumerBlueprint`
      - `OAuth2ConsumerBlueprint.__init__()`
      - `OAuth2ConsumerBlueprint.session`
      - `OAuth2ConsumerBlueprint.storage`
      - `OAuth2ConsumerBlueprint.token`
      - `OAuth2ConsumerBlueprint.config`
      - `OAuth2ConsumerBlueprint.from_config`
  - Storages
    - `SessionStorage`
      - `SessionStorage.__init__()`
    - `SQLAlchemyStorage`
      - `SQLAlchemyStorage.__init__()`
      - `SQLAlchemyStorage.get()`
  - Sessions
    - `OAuth1Session`
      - `OAuth1Session.token`
      - `OAuth1Session.authorized`
      - `OAuth1Session.authorization_required`
    - `OAuth2Session`
      - `OAuth2Session.token`
      - `OAuth2Session.access_token`
      - `OAuth2Session.authorized`
      - `OAuth2Session.authorization_required`
- Contributing to Flask-Dance
  - Providers
  - Documentation
  - Code

# Indices and tables

- Index

- Module Index

- Search Page