Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 173 for authorize (0.08 seconds)

  1. tests/test_security_oauth2_authorization_code_bearer_description.py

    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize",
        tokenUrl="token",
        description="OAuth2 Code Bearer",
        auto_error=True,
    )
    
    
    @app.get("/items/")
    async def read_items(token: str | None = Security(oauth2_scheme)):
        return {"token": token}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 2.5K bytes
    - Click Count (0)
  2. tests/test_security_oauth2_authorization_code_bearer.py

    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize", tokenUrl="token", auto_error=True
    )
    
    
    @app.get("/items/")
    async def read_items(token: str | None = Security(oauth2_scheme)):
        return {"token": token}
    
    
    client = TestClient(app)
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 2.7K bytes
    - Click Count (0)
  3. tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py

    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="api/oauth/authorize",
        tokenUrl="/api/oauth/token",
        scopes={"read": "Read access", "write": "Write access"},
    )
    
    
    async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str:
        return token
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 2.6K bytes
    - Click Count (0)
  4. tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py

    from fastapi.security import OAuth2AuthorizationCodeBearer
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    oauth2_scheme = OAuth2AuthorizationCodeBearer(
        authorizationUrl="authorize",
        tokenUrl="token",
        auto_error=True,
        scopes={"read": "Read access", "write": "Write access"},
    )
    
    
    async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str:
        return token
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 6.6K bytes
    - Click Count (0)
  5. docs/en/docs/tutorial/security/first-steps.md

    Go to the interactive docs at: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
    
    You will see something like this:
    
    <img src="/img/tutorial/security/image01.png">
    
    /// check | Authorize button!
    
    You already have a shiny new "Authorize" button.
    
    And your *path operation* has a little lock in the top-right corner that you can click.
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 07 09:29:03 GMT 2026
    - 8.3K bytes
    - Click Count (0)
  6. docs/ko/docs/tutorial/security/first-steps.md

    </div>
    
    ## 확인하기 { #check-it }
    
    대화형 문서로 이동하세요: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
    
    다음과 비슷한 화면이 보일 것입니다:
    
    <img src="/img/tutorial/security/image01.png">
    
    /// check | Authorize 버튼!
    
    반짝이는 새 "Authorize" 버튼이 이미 있습니다.
    
    그리고 *경로 처리*에는 오른쪽 상단에 클릭할 수 있는 작은 자물쇠가 있습니다.
    
    ///
    
    그리고 이를 클릭하면 `username`과 `password`(그리고 다른 선택적 필드들)를 입력할 수 있는 작은 인증 폼이 나타납니다:
    
    <img src="/img/tutorial/security/image02.png">
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 9.6K bytes
    - Click Count (0)
  7. docs/zh-hant/docs/tutorial/security/first-steps.md

    ```
    
    </div>
    
    ## 檢查 { #check-it }
    
    開啟互動式文件:[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)。
    
    你會看到類似這樣:
    
    <img src="/img/tutorial/security/image01.png">
    
    /// check | Authorize 按鈕!
    
    你會看到一個新的「Authorize」按鈕。
    
    而你的「路徑操作」右上角也會出現一個小鎖頭可以點擊。
    
    ///
    
    點擊後會跳出一個小視窗,讓你輸入 `username` 與 `password`(以及其他可選欄位):
    
    <img src="/img/tutorial/security/image02.png">
    
    /// note | 注意
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 7.2K bytes
    - Click Count (0)
  8. docs/zh/docs/tutorial/security/first-steps.md

    ```
    
    </div>
    
    ## 查看 { #check-it }
    
    打开交互式文档:[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)。
    
    你会看到类似这样的界面:
    
    <img src="/img/tutorial/security/image01.png">
    
    /// check | Authorize 按钮!
    
    页面右上角已经有一个崭新的“Authorize”按钮。
    
    你的*路径操作*右上角还有一个可点击的小锁图标。
    
    ///
    
    点击它,会弹出一个授权表单,可输入 `username` 和 `password`(以及其它可选字段):
    
    <img src="/img/tutorial/security/image02.png">
    
    /// note | 注意
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 7.5K bytes
    - Click Count (0)
  9. docs/en/docs/tutorial/security/oauth2-jwt.md

    ## Check it { #check-it }
    
    Run the server and go to the docs: [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).
    
    You'll see the user interface like:
    
    <img src="/img/tutorial/security/image07.png">
    
    Authorize the application the same way as before.
    
    Using the credentials:
    
    Username: `johndoe`
    Password: `secret`
    
    /// check
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 10.7K bytes
    - Click Count (0)
  10. docs/en/docs/advanced/security/oauth2-scopes.md

    {* ../../docs_src/security/tutorial005_an_py310.py hl[63:66] *}
    
    Because we are now declaring those scopes, they will show up in the API docs when you log-in/authorize.
    
    And you will be able to select which scopes you want to give access to: `me` and `items`.
    
    This is the same mechanism used when you give permissions while logging in with Facebook, Google, GitHub, etc:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 13.4K bytes
    - Click Count (0)
Back to Top