Debian Codegraph @

docs/index.rst

raw
1 Flask-Dance
2 ===========
3
4 Doing the OAuth dance with style using `Flask`_, `requests`_, and `oauthlib`_.
5 Check out just how easy it can be to hook up your Flask app with OAuth:
6
7 .. code-block:: python
8
9 from flask import Flask, redirect, url_for
10 from flask_dance.contrib.github import make_github_blueprint, github
11
12 app = Flask(__name__)
13 app.secret_key = "supersekrit" # Replace this with your own secret!
14 blueprint = make_github_blueprint(
15 client_id="my-key-here",
16 client_secret="my-secret-here",
17 )
18 app.register_blueprint(blueprint, url_prefix="/login")
19
20 @app.route("/")
21 def index():
22 if not github.authorized:
23 return redirect(url_for("github.login"))
24 resp = github.get("/user")
25 assert resp.ok
26 return "You are @{login} on GitHub".format(login=resp.json()["login"])
27
28 Ready to get started?
29
30 .. _Flask: http://flask.pocoo.org/
31 .. _requests: https://requests.readthedocs.io/
32 .. _oauthlib: https://oauthlib.readthedocs.io/
33
34 User Guide
35 ----------
36
37 .. toctree::
38 :maxdepth: 1
39
40 install
41 quickstart
42 concepts
43 understanding-the-magic
44 multi-user
45 logout
46 examples
47
48 Options & Configuration
49 -----------------------
50
51 .. toctree::
52 :maxdepth: 2
53
54 providers
55 storages
56 signals
57
58 Advanced Topics
59 ---------------
60
61 .. toctree::
62 how-oauth-works
63 proxies
64 testing
65 api
66 contributing
67
68 Indices and tables
69 ==================
70
71 * :ref:`genindex`
72 * :ref:`modindex`
73 * :ref:`search`
74