{"id":13421583,"url":"https://github.com/singingwolfboy/flask-dance","last_synced_at":"2025-05-14T13:09:50.276Z","repository":{"id":20551563,"uuid":"23831381","full_name":"singingwolfboy/flask-dance","owner":"singingwolfboy","description":"Doing the OAuth dance with style using Flask, requests, and oauthlib.","archived":false,"fork":false,"pushed_at":"2024-06-07T07:10:20.000Z","size":1129,"stargazers_count":1012,"open_issues_count":47,"forks_count":155,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-05-14T09:31:38.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/Flask-Dance/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/singingwolfboy.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"docs/contributing.rst","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"tidelift":"pypi/Flask-Dance"}},"created_at":"2014-09-09T11:53:06.000Z","updated_at":"2025-05-04T15:44:08.000Z","dependencies_parsed_at":"2024-04-08T21:55:24.355Z","dependency_job_id":null,"html_url":"https://github.com/singingwolfboy/flask-dance","commit_stats":{"total_commits":547,"total_committers":57,"mean_commits":9.596491228070175,"dds":"0.23765996343692875","last_synced_commit":"85180b9d7e171e5b4f57e1ab011650fd58f24a35"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwolfboy%2Fflask-dance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwolfboy%2Fflask-dance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwolfboy%2Fflask-dance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singingwolfboy%2Fflask-dance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/singingwolfboy","download_url":"https://codeload.github.com/singingwolfboy/flask-dance/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149977,"owners_count":22022852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T23:00:25.776Z","updated_at":"2025-05-14T13:09:45.264Z","avatar_url":"https://github.com/singingwolfboy.png","language":"Python","readme":"Flask-Dance |build-status| |coverage-status| |docs|\n===================================================\nDoing the OAuth dance with style using Flask, requests, and oauthlib. Currently,\nonly OAuth consumers are supported, but this project could easily support\nOAuth providers in the future, as well. The `full documentation for this project\nis hosted on ReadTheDocs \u003chttp://flask-dance.readthedocs.io/\u003e`_,\nincluding the full list of `supported OAuth providers`_,\nbut this README will give you a taste of the features.\n\nInstallation\n============\n\nJust the basics:\n\n.. code-block:: bash\n\n    $ pip install Flask-Dance\n\nOr if you're planning on using the `SQLAlchemy`_ storage:\n\n.. code-block:: bash\n\n    $ pip install Flask-Dance[sqla]\n\nQuickstart\n==========\nIf you want your users to be able to log in to your app from any of the\n`supported OAuth providers`_, you've got it easy. Here's an example using GitHub:\n\n.. code-block:: python\n\n    from flask import Flask, redirect, url_for\n    from flask_dance.contrib.github import make_github_blueprint, github\n\n    app = Flask(__name__)\n    app.secret_key = \"supersekrit\"\n    blueprint = make_github_blueprint(\n        client_id=\"my-key-here\",\n        client_secret=\"my-secret-here\",\n    )\n    app.register_blueprint(blueprint, url_prefix=\"/login\")\n\n    @app.route(\"/\")\n    def index():\n        if not github.authorized:\n            return redirect(url_for(\"github.login\"))\n        resp = github.get(\"/user\")\n        assert resp.ok\n        return \"You are @{login} on GitHub\".format(login=resp.json()[\"login\"])\n\nIf you're itching to try it out, check out the `flask-dance-github`_ example\nrepository, with detailed instructions for how to run this code.\n\nThe ``github`` object is a `context local`_, just like ``flask.request``. That means\nthat you can import it in any Python file you want, and use it in the context\nof an incoming HTTP request. If you've split your Flask app up into multiple\ndifferent files, feel free to import this object in any of your files, and use\nit just like you would use the ``requests`` module.\n\nYou can also use Flask-Dance with any OAuth provider you'd like, not just the\npre-set configurations. `See the documentation for how to use other OAuth\nproviders. \u003chttp://flask-dance.readthedocs.io/en/latest/providers.html\u003e`_\n\n.. _flask-dance-github: https://github.com/singingwolfboy/flask-dance-github\n.. _context local: http://flask.pocoo.org/docs/latest/quickstart/#context-locals\n\nStorages\n========\nBy default, OAuth access tokens are stored in Flask's session object.\nThis means that if the user ever clears their browser cookies, they will\nhave to go through the OAuth dance again, which is not good.\nYou're better off storing access tokens\nin a database or some other persistent store, and Flask-Dance has support for\nswapping out the token storage. For example, if you're using `SQLAlchemy`_,\nset it up like this:\n\n.. code-block:: python\n\n    from flask_sqlalchemy import SQLAlchemy\n    from flask_dance.consumer.storage.sqla import OAuthConsumerMixin, SQLAlchemyStorage\n\n    db = SQLAlchemy()\n\n    class User(db.Model):\n        id = db.Column(db.Integer, primary_key=True)\n        # ... other columns as needed\n\n    class OAuth(OAuthConsumerMixin, db.Model):\n        user_id = db.Column(db.Integer, db.ForeignKey(User.id))\n        user = db.relationship(User)\n\n    # get_current_user() is a function that returns the current logged in user\n    blueprint.storage = SQLAlchemyStorage(OAuth, db.session, user=get_current_user)\n\nThe SQLAlchemy storage seamlessly integrates with `Flask-SQLAlchemy`_,\nas well as `Flask-Login`_ for user management, and `Flask-Caching`_ for caching.\n\nFull Documentation\n==================\nThis README provides just a taste of what Flask-Dance is capable of. To see more,\n`read the documentation on ReadTheDocs \u003chttp://flask-dance.readthedocs.io/\u003e`_.\n\nSecurity contact information\n============================\n\nTo report a security vulnerability, please use the `Tidelift security contact`_.\nTidelift will coordinate the fix and disclosure.\n\n.. _supported OAuth providers: https://flask-dance.readthedocs.io/en/latest/providers.html\n.. _SQLAlchemy: http://www.sqlalchemy.org/\n.. _Flask-SQLAlchemy: http://pythonhosted.org/Flask-SQLAlchemy/\n.. _Flask-Login: https://flask-login.readthedocs.io/\n.. _Flask-Caching: https://flask-caching.readthedocs.io/\n.. _Tidelift security contact: https://tidelift.com/security\n\n.. |build-status| image:: https://github.com/singingwolfboy/flask-dance/workflows/Test/badge.svg\n   :target: https://github.com/singingwolfboy/flask-dance/actions?query=workflow%3ATest\n   :alt: Build status\n.. |coverage-status| image:: http://codecov.io/github/singingwolfboy/flask-dance/coverage.svg?branch=main\n   :target: http://codecov.io/github/singingwolfboy/flask-dance?branch=main\n   :alt: Test coverage\n.. |docs| image:: https://readthedocs.org/projects/flask-dance/badge/?version=latest\u0026style=flat\n   :target: http://flask-dance.readthedocs.io/\n   :alt: Documentation\n","funding_links":["https://tidelift.com/funding/github/pypi/Flask-Dance","https://tidelift.com/security"],"categories":["Python","Authorization","Third-Party Extensions","Authorization \u0026 Authentication"],"sub_categories":["Auth"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsingingwolfboy%2Fflask-dance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsingingwolfboy%2Fflask-dance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsingingwolfboy%2Fflask-dance/lists"}