And another one to authenticate and return a user.
-//// tab | Python 3.10+
-
-```Python hl_lines="8 49 56-57 60-61 70-76"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="8 49 56-57 60-61 70-76"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="8 50 57-58 61-62 71-77"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="7 48 55-56 59-60 69-75"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="8 49 56-57 60-61 70-76"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[8,49,56:57,60:61,70:76] *}
/// note
Create a utility function to generate a new access token.
-//// tab | Python 3.10+
-
-```Python hl_lines="4 7 13-15 29-31 79-87"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="4 7 13-15 29-31 79-87"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="4 7 14-16 30-32 80-88"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="3 6 12-14 28-30 78-86"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="4 7 13-15 29-31 79-87"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[4,7,13:15,29:31,79:87] *}
## Update the dependencies
If the token is invalid, return an HTTP error right away.
-//// tab | Python 3.10+
-
-```Python hl_lines="90-107"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="90-107"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="91-108"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="89-106"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="90-107"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[90:107] *}
## Update the `/token` *path operation*
Create a real JWT access token and return it.
-//// tab | Python 3.10+
-
-```Python hl_lines="118-133"
-{!> ../../docs_src/security/tutorial004_an_py310.py!}
-```
-
-////
-
-//// tab | Python 3.9+
-
-```Python hl_lines="118-133"
-{!> ../../docs_src/security/tutorial004_an_py39.py!}
-```
-
-////
-
-//// tab | Python 3.8+
-
-```Python hl_lines="119-134"
-{!> ../../docs_src/security/tutorial004_an.py!}
-```
-
-////
-
-//// tab | Python 3.10+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="115-130"
-{!> ../../docs_src/security/tutorial004_py310.py!}
-```
-
-////
-
-//// tab | Python 3.8+ non-Annotated
-
-/// tip
-
-Prefer to use the `Annotated` version if possible.
-
-///
-
-```Python hl_lines="116-131"
-{!> ../../docs_src/security/tutorial004.py!}
-```
-
-////
+{* ../../docs_src/security/tutorial004_an_py310.py hl[118:133] *}
### Technical details about the JWT "subject" `sub`