Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for tokenUrl (0.07 sec)

  1. tests/test_security_oauth2_authorization_code_bearer_description.py

    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize",
        tokenUrl="token",
        description="OAuth2 Code Bearer",
        auto_error=True,
    )
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        return {"token": token}
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.4K bytes
    - Viewed (0)
  2. tests/test_security_oauth2_password_bearer_optional.py

    from typing import Optional
    
    from fastapi import FastAPI, Security
    from fastapi.security import OAuth2PasswordBearer
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/token", auto_error=False)
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        if token is None:
            return {"msg": "Create an account first"}
        return {"token": token}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  3. tests/test_security_oauth2_authorization_code_bearer.py

    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize", tokenUrl="token", auto_error=True
    )
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        return {"token": token}
    
    
    client = TestClient(app)
    
    
    def test_no_token():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.3K bytes
    - Viewed (0)
  4. docs/em/docs/tutorial/security/first-steps.md

    ๐Ÿ‘ˆ ๐Ÿ’ผ, **FastAPI** ๐Ÿšš ๐Ÿ‘† โฎ๏ธ ๐Ÿงฐ ๐Ÿ— โšซ๏ธ.
    
    ///
    
    ๐Ÿ•โ” ๐Ÿ‘ฅ โœ ๐Ÿ‘ `OAuth2PasswordBearer` ๐ŸŽ“ ๐Ÿ‘ฅ ๐Ÿšถโ€โ™€๏ธ `tokenUrl` ๐Ÿ”ข. ๐Ÿ‘‰ ๐Ÿ”ข ๐Ÿ”Œ ๐Ÿ“› ๐Ÿ‘ˆ ๐Ÿ‘ฉโ€๐Ÿ’ป (๐Ÿ•ธ ๐Ÿƒ ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿ–ฅ) ๐Ÿ”œ โš™๏ธ ๐Ÿ“จ `username` & `password` โœ” ๐Ÿคš ๐Ÿค.
    
    ```Python hl_lines="6"
    {!../../docs_src/security/tutorial001.py!}
    ```
    
    /// tip
    
    ๐Ÿ“ฅ `tokenUrl="token"` ๐Ÿ”— โš– ๐Ÿ“› `token` ๐Ÿ‘ˆ ๐Ÿ‘ฅ ๐Ÿšซ โœ. โšซ๏ธ โš– ๐Ÿ“›, โšซ๏ธ ๐ŸŒ“ `./token`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.8K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/security/first-steps.md

    ```Python hl_lines="6"
    {!../../docs_src/security/tutorial001.py!}
    ```
    
    /// tip | "Dica"
    
    
    
    ///
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8.4K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/security/first-steps.md

    ็”š่‡ณๅฏไปฅ่ฏด๏ผŒๅฎƒๆ˜ฏ้€‚็”จไบŽ็ปๅคงๅคšๆ•ฐ็”จไพ‹็š„ๆœ€ไฝณๆ–นๆกˆ๏ผŒ้™ค้žๆ‚จๆ˜ฏ OAuth2 ็š„ไธ“ๅฎถ๏ผŒ็Ÿฅ้“ไธบไป€ไนˆๅ…ถๅฎƒๆ–นๆกˆๆ›ดๅˆ้€‚ใ€‚
    
    ๆœฌไพ‹ไธญ๏ผŒ**FastAPI** ่ฟ˜ๆไพ›ไบ†ๆž„ๅปบๅทฅๅ…ทใ€‚
    
    ///
    
    ๅˆ›ๅปบ `OAuth2PasswordBearer` ็š„็ฑปๅฎžไพ‹ๆ—ถ๏ผŒ่ฆไผ ้€’ `tokenUrl` ๅ‚ๆ•ฐใ€‚่ฏฅๅ‚ๆ•ฐๅŒ…ๅซๅฎขๆˆท็ซฏ๏ผˆ็”จๆˆทๆต่งˆๅ™จไธญ่ฟ่กŒ็š„ๅ‰็ซฏ๏ผ‰ ็š„ URL๏ผŒ็”จไบŽๅ‘้€ `username` ไธŽ `password`๏ผŒๅนถ่Žทๅ–ไปค็‰Œใ€‚
    
    ```Python hl_lines="6"
    {!../../docs_src/security/tutorial001.py!}
    ```
    
    /// tip | "ๆ็คบ"
    
    ๅœจๆญค๏ผŒ`tokenUrl="token"` ๆŒ‡ๅ‘็š„ๆ˜ฏๆš‚ๆœชๅˆ›ๅปบ็š„็›ธๅฏน URL `token`ใ€‚่ฟ™ไธช็›ธๅฏน URL ็›ธๅฝ“ไบŽ `./token`ใ€‚
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  7. tests/test_security_oauth2_password_bearer_optional_description.py

    from typing import Optional
    
    from fastapi import FastAPI, Security
    from fastapi.security import OAuth2PasswordBearer
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(
        tokenUrl="/token",
        description="OAuth2PasswordBearer security scheme",
        auto_error=False,
    )
    
    
    @app.get("/items/")
    async def read_items(token: Optional[str] = Security(oauth2_scheme)):
        if token is None:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/security/first-steps.md

    We will soon also create the actual path operation.
    
    /// info
    
    If you are a very strict "Pythonista" you might dislike the style of the parameter name `tokenUrl` instead of `token_url`.
    
    That's because it is using the same name as in the OpenAPI spec. So that if you need to investigate more about any of these security schemes you can just copy and paste it to find more information about it.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.2K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_security/test_tutorial001.py

                }
            },
            "components": {
                "securitySchemes": {
                    "OAuth2PasswordBearer": {
                        "type": "oauth2",
                        "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
                    }
                }
            },
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  10. docs_src/security/tutorial001.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 Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 10 17:28:18 UTC 2020
    - 269 bytes
    - Viewed (0)
Back to top