File tree Expand file tree Collapse file tree 16 files changed +3
-129
lines changed
docs/docs/08_flask_jwt_extended
03_flask_jwt_extended_setup/end
05_registering_users_rest_api
07_protect_resources_with_jwt_required
08_jwt_claims_and_authorization
10_token_refreshing_flask_jwt_extended Expand file tree Collapse file tree 16 files changed +3
-129
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
25
25
db .init_app (app )
26
26
api = Api (app )
27
27
28
- """
29
- JWT related configuration. The following functions includes:
30
- 1) add claims to each jwt
31
- 2) customize the token expired error message
32
- """
33
28
app .config ["JWT_SECRET_KEY" ] = "jose"
34
29
jwt = JWTManager (app )
35
30
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
25
25
db .init_app (app )
26
26
api = Api (app )
27
27
28
- """
29
- JWT related configuration. The following functions includes:
30
- 1) add claims to each jwt
31
- 2) customize the token expired error message
32
- """
33
28
app .config ["JWT_SECRET_KEY" ] = "jose"
34
29
jwt = JWTManager (app )
35
30
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
25
25
db .init_app (app )
26
26
api = Api (app )
27
27
28
- """
29
- JWT related configuration. The following functions includes:
30
- 1) add claims to each jwt
31
- 2) customize the token expired error message
32
- """
33
28
app .config ["JWT_SECRET_KEY" ] = "jose"
34
29
jwt = JWTManager (app )
35
30
Original file line number Diff line number Diff line change @@ -26,11 +26,6 @@ def create_app(db_url=None):
26
26
db .init_app (app )
27
27
api = Api (app )
28
28
29
- """
30
- JWT related configuration. The following functions includes:
31
- 1) add claims to each jwt
32
- 2) customize the token expired error message
33
- """
34
29
app .config ["JWT_SECRET_KEY" ] = "jose"
35
30
jwt = JWTManager (app )
36
31
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
25
25
db .init_app (app )
26
26
api = Api (app )
27
27
28
- """
29
- JWT related configuration. The following functions includes:
30
- 1) add claims to each jwt
31
- 2) customize the token expired error message
32
- """
33
28
app .config ["JWT_SECRET_KEY" ] = "jose"
34
29
jwt = JWTManager (app )
35
30
Original file line number Diff line number Diff line change 1
- from flask import Flask , jsonify
1
+ from flask import Flask
2
2
from flask_smorest import Api
3
3
from flask_jwt_extended import JWTManager
4
4
@@ -26,11 +26,6 @@ def create_app(db_url=None):
26
26
db .init_app (app )
27
27
api = Api (app )
28
28
29
- """
30
- JWT related configuration. The following functions includes:
31
- 1) add claims to each jwt
32
- 2) customize the token expired error message
33
- """
34
29
app .config ["JWT_SECRET_KEY" ] = "jose"
35
30
jwt = JWTManager (app )
36
31
Original file line number Diff line number Diff line change @@ -26,11 +26,6 @@ def create_app(db_url=None):
26
26
db .init_app (app )
27
27
api = Api (app )
28
28
29
- """
30
- JWT related configuration. The following functions includes:
31
- 1) add claims to each jwt
32
- 2) customize the token expired error message
33
- """
34
29
app .config ["JWT_SECRET_KEY" ] = "jose"
35
30
jwt = JWTManager (app )
36
31
Original file line number Diff line number Diff line change @@ -26,20 +26,9 @@ def create_app(db_url=None):
26
26
db .init_app (app )
27
27
api = Api (app )
28
28
29
- """
30
- JWT related configuration. The following functions includes:
31
- 1) add claims to each jwt
32
- 2) customize the token expired error message
33
- """
34
29
app .config ["JWT_SECRET_KEY" ] = "jose"
35
30
jwt = JWTManager (app )
36
31
37
- """
38
- `claims` are data we choose to attach to each jwt payload
39
- and for each jwt protected endpoint, we can retrieve these claims via `get_jwt_claims()`
40
- one possible use case for claims are access level control, which is shown below
41
- """
42
-
43
32
@jwt .expired_token_loader
44
33
def expired_token_callback (jwt_header , jwt_payload ):
45
34
return (
Original file line number Diff line number Diff line change 1
- from flask import Flask , jsonify
1
+ from flask import Flask
2
2
from flask_smorest import Api
3
3
from flask_jwt_extended import JWTManager
4
4
@@ -26,11 +26,6 @@ def create_app(db_url=None):
26
26
db .init_app (app )
27
27
api = Api (app )
28
28
29
- """
30
- JWT related configuration. The following functions includes:
31
- 1) add claims to each jwt
32
- 2) customize the token expired error message
33
- """
34
29
app .config ["JWT_SECRET_KEY" ] = "jose"
35
30
jwt = JWTManager (app )
36
31
Original file line number Diff line number Diff line change @@ -26,20 +26,9 @@ def create_app(db_url=None):
26
26
db .init_app (app )
27
27
api = Api (app )
28
28
29
- """
30
- JWT related configuration. The following functions includes:
31
- 1) add claims to each jwt
32
- 2) customize the token expired error message
33
- """
34
29
app .config ["JWT_SECRET_KEY" ] = "jose"
35
30
jwt = JWTManager (app )
36
31
37
- """
38
- `claims` are data we choose to attach to each jwt payload
39
- and for each jwt protected endpoint, we can retrieve these claims via `get_jwt_claims()`
40
- one possible use case for claims are access level control, which is shown below
41
- """
42
-
43
32
# @jwt.additional_claims_loader
44
33
# def add_claims_to_jwt(identity):
45
34
# # TODO: Read from a config file instead of hard-coding
You can’t perform that action at this time.
0 commit comments