Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for OAuth2PasswordBearer (0.08 sec)

  1. docs_src/security/tutorial002_py39.py

    from typing import Union
    
    from fastapi import Depends, FastAPI
    from fastapi.security import OAuth2PasswordBearer
    from pydantic import BaseModel
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    class User(BaseModel):
        username: str
        email: Union[str, None] = None
        full_name: Union[str, None] = None
        disabled: Union[bool, None] = None
    
    
    def fake_decode_token(token):
        return User(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 755 bytes
    - Viewed (0)
  2. docs/pt/docs/tutorial/security/first-steps.md

    ## O `OAuth2PasswordBearer` do **FastAPI** { #fastapis-oauth2passwordbearer }
    
    O **FastAPI** fornece várias ferramentas, em diferentes níveis de abstração, para implementar essas funcionalidades de segurança.
    
    Neste exemplo, vamos usar **OAuth2**, com o fluxo **Password**, usando um token **Bearer**. Fazemos isso usando a classe `OAuth2PasswordBearer`.
    
    /// info | Informação
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 12 16:23:57 UTC 2025
    - 8.9K bytes
    - Viewed (0)
  3. docs/es/docs/tutorial/security/first-steps.md

    ## `OAuth2PasswordBearer` de **FastAPI** { #fastapis-oauth2passwordbearer }
    
    **FastAPI** proporciona varias herramientas, en diferentes niveles de abstracción, para implementar estas funcionalidades de seguridad.
    
    En este ejemplo vamos a usar **OAuth2**, con el flujo **Password**, usando un token **Bearer**. Hacemos eso utilizando la clase `OAuth2PasswordBearer`.
    
    /// info | Información
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 8.9K bytes
    - Viewed (0)
  4. docs_src/security/tutorial003_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from pydantic import BaseModel
    
    fake_users_db = {
        "johndoe": {
            "username": "johndoe",
            "full_name": "John Doe",
            "email": "******@****.***",
            "hashed_password": "fakehashedsecret",
            "disabled": False,
        },
        "alice": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 24 19:03:06 UTC 2025
    - 2.5K bytes
    - Viewed (0)
  5. docs_src/security/tutorial004_an_py310.py

    from datetime import datetime, timedelta, timezone
    from typing import Annotated
    
    import jwt
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from jwt.exceptions import InvalidTokenError
    from pwdlib import PasswordHash
    from pydantic import BaseModel
    
    # to get a string like this run:
    # openssl rand -hex 32
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 02:57:38 UTC 2025
    - 4.1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_security/test_tutorial002.py

                        "operationId": "read_users_me_users_me_get",
                        "security": [{"OAuth2PasswordBearer": []}],
                    }
                }
            },
            "components": {
                "securitySchemes": {
                    "OAuth2PasswordBearer": {
                        "type": "oauth2",
                        "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
                    }
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  7. docs_src/security/tutorial001_py39.py

    from fastapi import Depends, FastAPI
    from fastapi.security import OAuth2PasswordBearer
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    @app.get("/items/")
    async def read_items(token: str = Depends(oauth2_scheme)):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 269 bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/security/first-steps.md

    ## **FastAPI**'s `OAuth2PasswordBearer` { #fastapis-oauth2passwordbearer }
    
    **FastAPI** provides several tools, at different levels of abstraction, to implement these security features.
    
    In this example we are going to use **OAuth2**, with the **Password** flow, using a **Bearer** token. We do that using the `OAuth2PasswordBearer` class.
    
    /// info
    
    A "bearer" token is not the only option.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 8.4K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_security/test_tutorial005.py

                                }
                            },
                            "summary": "Read Users Me",
                            "operationId": "read_users_me_users_me__get",
                            "security": [{"OAuth2PasswordBearer": ["me"]}],
                        }
                    },
                    "/users/me/items/": {
                        "get": {
                            "responses": {
                                "200": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 15.8K bytes
    - Viewed (0)
  10. docs_src/security/tutorial003_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from pydantic import BaseModel
    
    fake_users_db = {
        "johndoe": {
            "username": "johndoe",
            "full_name": "John Doe",
            "email": "******@****.***",
            "hashed_password": "fakehashedsecret",
            "disabled": False,
        },
        "alice": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 24 19:03:06 UTC 2025
    - 2.5K bytes
    - Viewed (0)
Back to top