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):
2525 db .init_app (app )
2626 api = Api (app )
2727
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- """
3328 app .config ["JWT_SECRET_KEY" ] = "jose"
3429 jwt = JWTManager (app )
3530
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
2525 db .init_app (app )
2626 api = Api (app )
2727
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- """
3328 app .config ["JWT_SECRET_KEY" ] = "jose"
3429 jwt = JWTManager (app )
3530
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
2525 db .init_app (app )
2626 api = Api (app )
2727
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- """
3328 app .config ["JWT_SECRET_KEY" ] = "jose"
3429 jwt = JWTManager (app )
3530
Original file line number Diff line number Diff line change @@ -26,11 +26,6 @@ def create_app(db_url=None):
2626 db .init_app (app )
2727 api = Api (app )
2828
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- """
3429 app .config ["JWT_SECRET_KEY" ] = "jose"
3530 jwt = JWTManager (app )
3631
Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ def create_app(db_url=None):
2525 db .init_app (app )
2626 api = Api (app )
2727
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- """
3328 app .config ["JWT_SECRET_KEY" ] = "jose"
3429 jwt = JWTManager (app )
3530
Original file line number Diff line number Diff line change 1- from flask import Flask , jsonify
1+ from flask import Flask
22from flask_smorest import Api
33from flask_jwt_extended import JWTManager
44
@@ -26,11 +26,6 @@ def create_app(db_url=None):
2626 db .init_app (app )
2727 api = Api (app )
2828
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- """
3429 app .config ["JWT_SECRET_KEY" ] = "jose"
3530 jwt = JWTManager (app )
3631
Original file line number Diff line number Diff line change @@ -26,11 +26,6 @@ def create_app(db_url=None):
2626 db .init_app (app )
2727 api = Api (app )
2828
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- """
3429 app .config ["JWT_SECRET_KEY" ] = "jose"
3530 jwt = JWTManager (app )
3631
Original file line number Diff line number Diff line change @@ -26,20 +26,9 @@ def create_app(db_url=None):
2626 db .init_app (app )
2727 api = Api (app )
2828
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- """
3429 app .config ["JWT_SECRET_KEY" ] = "jose"
3530 jwt = JWTManager (app )
3631
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-
4332 @jwt .expired_token_loader
4433 def expired_token_callback (jwt_header , jwt_payload ):
4534 return (
Original file line number Diff line number Diff line change 1- from flask import Flask , jsonify
1+ from flask import Flask
22from flask_smorest import Api
33from flask_jwt_extended import JWTManager
44
@@ -26,11 +26,6 @@ def create_app(db_url=None):
2626 db .init_app (app )
2727 api = Api (app )
2828
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- """
3429 app .config ["JWT_SECRET_KEY" ] = "jose"
3530 jwt = JWTManager (app )
3631
Original file line number Diff line number Diff line change @@ -26,20 +26,9 @@ def create_app(db_url=None):
2626 db .init_app (app )
2727 api = Api (app )
2828
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- """
3429 app .config ["JWT_SECRET_KEY" ] = "jose"
3530 jwt = JWTManager (app )
3631
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-
4332 # @jwt.additional_claims_loader
4433 # def add_claims_to_jwt(identity):
4534 # # TODO: Read from a config file instead of hard-coding
You can’t perform that action at this time.
0 commit comments