Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 19 for grant_type (0.24 seconds)

  1. tests/test_security_oauth2_optional.py

            pytest.param("blahpassword", id="password with prefix"),
        ],
    )
    def test_strict_login_incorrect_grant_type(grant_type: str):
        response = client.post(
            "/login",
            data={"username": "johndoe", "password": "secret", "grant_type": grant_type},
        )
        assert response.status_code == 422
        assert response.json() == {
            "detail": [
                {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 9.8K bytes
    - Click Count (0)
  2. tests/test_security_oauth2.py

            pytest.param("blahpassword", id="password with prefix"),
        ],
    )
    def test_strict_login_incorrect_grant_type(grant_type: str):
        response = client.post(
            "/login",
            data={"username": "johndoe", "password": "secret", "grant_type": grant_type},
        )
        assert response.status_code == 422
        assert response.json() == {
            "detail": [
                {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 9.8K bytes
    - Click Count (0)
  3. tests/test_security_oauth2_optional_description.py

            pytest.param("blahpassword", id="password with prefix"),
        ],
    )
    def test_strict_login_incorrect_grant_type(grant_type: str):
        response = client.post(
            "/login",
            data={"username": "johndoe", "password": "secret", "grant_type": grant_type},
        )
        assert response.status_code == 422
        assert response.json() == {
            "detail": [
                {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 9.9K bytes
    - Click Count (0)
  4. fastapi/security/oauth2.py

                    sending the `client_id` and `client_secret` (if any) using HTTP Basic
                    auth.
                    """
                ),
            ] = None,
        ):
            self.grant_type = grant_type
            self.username = username
            self.password = password
            self.scopes = scope.split()
            self.client_id = client_id
            self.client_secret = client_secret
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Mar 24 16:32:10 GMT 2026
    - 23.6K bytes
    - Click Count (0)
  5. docs/sts/wso2.md

    Request
    
    ```
    curl -u <CLIENT_ID>:<CLIENT_SECRET> -k -d "grant_type=client_credentials" -H "Content-Type:application/x-www-form-urlencoded" https://<IS_HOST>:<IS_HTTPS_PORT>/oauth2/token
    ```
    
    Example:
    
    ```
    curl -u PoEgXP6uVO45IsENRngDXj5Au5Ya:eKsw6z8CtOJVBtrOWvhRWL4TUCga -k -d "grant_type=client_credentials" -H "Content-Type:application/x-www-form-urlencoded" https://localhost:9443/oauth2/token
    ```
    
    Created: Sun Apr 05 19:28:12 GMT 2026
    - Last Modified: Tue Aug 12 18:20:36 GMT 2025
    - 8.7K bytes
    - Click Count (0)
  6. docs/en/docs/tutorial/security/simple-oauth2.md

    * The `username`.
    * The `password`.
    * An optional `scope` field as a big string, composed of strings separated by spaces.
    * An optional `grant_type`.
    
    /// tip
    
    The OAuth2 spec actually *requires* a field `grant_type` with a fixed value of `password`, but `OAuth2PasswordRequestForm` doesn't enforce it.
    
    If you need to enforce it, use `OAuth2PasswordRequestFormStrict` instead of `OAuth2PasswordRequestForm`.
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 9.4K bytes
    - Click Count (0)
  7. docs/zh-hant/docs/tutorial/security/simple-oauth2.md

    {* ../../docs_src/security/tutorial003_an_py310.py hl[4,78] *}
    
    `OAuth2PasswordRequestForm` 是一個類別型依賴,它宣告了一個表單本文,包含:
    
    - `username`
    - `password`
    - 可選的 `scope` 欄位,內容是一個由空白分隔的長字串
    - 可選的 `grant_type`
    
    /// tip
    
    依規範,實際上需要一個 `grant_type` 欄位且固定值為 `password`,但 `OAuth2PasswordRequestForm` 並不會強制檢查。
    
    如果你需要強制檢查,請改用 `OAuth2PasswordRequestFormStrict` 取代 `OAuth2PasswordRequestForm`。
    
    ///
    
    - 可選的 `client_id`(本例不需要)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 9.1K bytes
    - Click Count (0)
  8. docs/zh/docs/tutorial/security/simple-oauth2.md

    {* ../../docs_src/security/tutorial003_an_py310.py hl[4,78] *}
    
    `OAuth2PasswordRequestForm` 是用以下几项内容声明表单请求体的类依赖项:
    
    * `username`
    * `password`
    * 可选的 `scope` 字段,由多个空格分隔的字符串组成的长字符串
    * 可选的 `grant_type`
    
    /// tip | 提示
    
    实际上,OAuth2 规范*要求* `grant_type` 字段使用固定值 `password`,但 `OAuth2PasswordRequestForm` 没有作强制约束。
    
    如需强制使用固定值 `password`,则不要用 `OAuth2PasswordRequestForm`,而是用 `OAuth2PasswordRequestFormStrict`。
    
    ///
    
    * 可选的 `client_id`(本例未使用)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 9K bytes
    - Click Count (0)
  9. docs/ja/docs/tutorial/security/simple-oauth2.md

    `OAuth2PasswordRequestForm` は次のフォームボディを宣言するクラス依存関係です:
    
    - `username`
    - `password`
    - スペース区切りの文字列で構成される、オプションの `scope` フィールド
    - オプションの `grant_type`
    
    /// tip | 豆知識
    
    OAuth2 の仕様では、固定値 `password` を持つフィールド `grant_type` が実際には必須ですが、`OAuth2PasswordRequestForm` はそれを強制しません。
    
    強制したい場合は、`OAuth2PasswordRequestForm` の代わりに `OAuth2PasswordRequestFormStrict` を使ってください。
    
    ///
    
    - オプションの `client_id`(この例では不要)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 12.1K bytes
    - Click Count (0)
  10. docs/sts/keycloak.md

    After that, you will be able to obtain an id_token for the Admin REST API using client_id and client_secret:
    
    ```
    curl \
      -d "client_id=<YOUR_CLIENT_ID>" \
      -d "client_secret=<YOUR_CLIENT_SECRET>" \
      -d "grant_type=client_credentials" \
      "http://localhost:8080/auth/realms/{realm}/protocol/openid-connect/token"
    ```
    
    Created: Sun Apr 05 19:28:12 GMT 2026
    - Last Modified: Tue Aug 12 18:20:36 GMT 2025
    - 8.1K bytes
    - Click Count (0)
Back to Top