OAuth2 flow for authentication using a bearer token obtained with a password. An instance of it would be used as a dependency. Read more about it in the [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/).
| 431 | |
| 432 | |
| 433 | class OAuth2PasswordBearer(OAuth2): |
| 434 | """ |
| 435 | OAuth2 flow for authentication using a bearer token obtained with a password. |
| 436 | An instance of it would be used as a dependency. |
| 437 | |
| 438 | Read more about it in the |
| 439 | [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/). |
| 440 | """ |
| 441 | |
| 442 | def __init__( |
| 443 | self, |
| 444 | tokenUrl: Annotated[ |
| 445 | str, |
| 446 | Doc( |
| 447 | """ |
| 448 | The URL to obtain the OAuth2 token. This would be the *path operation* |
| 449 | that has `OAuth2PasswordRequestForm` as a dependency. |
| 450 | |
| 451 | Read more about it in the |
| 452 | [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/). |
| 453 | """ |
| 454 | ), |
| 455 | ], |
| 456 | scheme_name: Annotated[ |
| 457 | str | None, |
| 458 | Doc( |
| 459 | """ |
| 460 | Security scheme name. |
| 461 | |
| 462 | It will be included in the generated OpenAPI (e.g. visible at `/docs`). |
| 463 | """ |
| 464 | ), |
| 465 | ] = None, |
| 466 | scopes: Annotated[ |
| 467 | dict[str, str] | None, |
| 468 | Doc( |
| 469 | """ |
| 470 | The OAuth2 scopes that would be required by the *path operations* that |
| 471 | use this dependency. |
| 472 | |
| 473 | Read more about it in the |
| 474 | [FastAPI docs for Simple OAuth2 with Password and Bearer](https://fastapi.tiangolo.com/tutorial/security/simple-oauth2/). |
| 475 | """ |
| 476 | ), |
| 477 | ] = None, |
| 478 | description: Annotated[ |
| 479 | str | None, |
| 480 | Doc( |
| 481 | """ |
| 482 | Security scheme description. |
| 483 | |
| 484 | It will be included in the generated OpenAPI (e.g. visible at `/docs`). |
| 485 | """ |
| 486 | ), |
| 487 | ] = None, |
| 488 | auto_error: Annotated[ |
| 489 | bool, |
| 490 | Doc( |
no outgoing calls
no test coverage detected
searching dependent graphs…