File: api.rst

package info (click to toggle)
python-authlib 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,016 kB
  • sloc: python: 26,998; makefile: 53; sh: 14
file content (64 lines) | stat: -rw-r--r-- 1,531 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
API References of Flask OAuth 2.0 Server
========================================

This part of the documentation covers the interface of Flask OAuth 2.0
Server.

.. module:: authlib.integrations.flask_oauth2

.. autoclass:: AuthorizationServer
    :members:
        register_grant,
        register_endpoint,
        create_bearer_token_generator,
        get_consent_grant,
        create_authorization_response,
        create_token_response,
        create_endpoint_response

.. autoclass:: ResourceProtector
    :member-order: bysource
    :members:

.. data:: current_token

    Routes protected by :class:`ResourceProtector` can access current token
    with this variable::

        from authlib.integrations.flask_oauth2 import current_token

        @require_oauth()
        @app.route('/user_id')
        def user_id():
            # current token instance of the OAuth Token model
            return current_token.user_id

.. data:: client_authenticated

    Signal when client is authenticated

.. data:: token_revoked

    Signal when token is revoked

.. data:: token_authenticated

    Signal when token is authenticated


SQLAlchemy Helper Functions
---------------------------

.. warning:: We will drop ``sqla_oauth2`` module in version 1.0.

.. module:: authlib.integrations.sqla_oauth2

.. autofunction:: create_query_client_func

.. autofunction:: create_save_token_func

.. autofunction:: create_query_token_func

.. autofunction:: create_revocation_endpoint

.. autofunction:: create_bearer_token_validator