mirror of https://github.com/tiangolo/fastapi.git
add refreshurl to OAuth2PasswordBearer
This commit is contained in:
parent
3425c834cc
commit
f0dc846ea2
|
|
@ -507,6 +507,7 @@ class OAuthFlowImplicit(OAuthFlow):
|
|||
|
||||
class OAuthFlowPassword(OAuthFlow):
|
||||
tokenUrl: str
|
||||
refreshUrl: Optional[str]
|
||||
|
||||
|
||||
class OAuthFlowClientCredentials(OAuthFlow):
|
||||
|
|
|
|||
|
|
@ -408,6 +408,14 @@ class OAuth2PasswordBearer(OAuth2):
|
|||
"""
|
||||
),
|
||||
],
|
||||
refreshUrl: Annotated[
|
||||
Optional[str],
|
||||
Doc(
|
||||
"""
|
||||
The URL to refresh the token and obtain a new one.
|
||||
"""
|
||||
),
|
||||
],
|
||||
scheme_name: Annotated[
|
||||
Optional[str],
|
||||
Doc(
|
||||
|
|
@ -461,7 +469,9 @@ class OAuth2PasswordBearer(OAuth2):
|
|||
if not scopes:
|
||||
scopes = {}
|
||||
flows = OAuthFlowsModel(
|
||||
password=cast(Any, {"tokenUrl": tokenUrl, "scopes": scopes})
|
||||
password=cast(
|
||||
Any, {"tokenUrl": tokenUrl, "refreshUrl": refreshUrl, "scopes": scopes}
|
||||
)
|
||||
)
|
||||
super().__init__(
|
||||
flows=flows,
|
||||
|
|
|
|||
Loading…
Reference in New Issue