fix documentation tokenUrl (#210)

* fix documentation tokenUrl

* Change default login tokenUrl
This commit is contained in:
Eric Lopes
2020-06-15 20:33:52 +08:00
committed by GitHub
parent 624172ccf9
commit 75147a7071
8 changed files with 8 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ def on_after_forgot_password(user: UserDB, token: str, request: Request):
print(f"User {user.id} has forgot their password. Reset token: {token}")
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl='/auth/jwt/login')
app = FastAPI()
fastapi_users = FastAPIUsers(

View File

@@ -51,7 +51,7 @@ def on_after_forgot_password(user: UserDB, token: str, request: Request):
print(f"User {user.id} has forgot their password. Reset token: {token}")
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl='/auth/jwt/login')
app = FastAPI()
fastapi_users = FastAPIUsers(

View File

@@ -41,7 +41,7 @@ def on_after_forgot_password(user: UserDB, token: str, request: Request):
print(f"User {user.id} has forgot their password. Reset token: {token}")
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl='/auth/jwt/login')
fastapi_users = FastAPIUsers(
user_db, [jwt_authentication], User, UserCreate, UserUpdate, UserDB,

View File

@@ -44,7 +44,7 @@ def on_after_forgot_password(user: UserDB, token: str, request: Request):
print(f"User {user.id} has forgot their password. Reset token: {token}")
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl='/auth/jwt/login')
app = FastAPI()
fastapi_users = FastAPIUsers(

View File

@@ -64,7 +64,7 @@ def on_after_forgot_password(user: UserDB, token: str, request: Request):
print(f"User {user.id} has forgot their password. Reset token: {token}")
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl='/auth/jwt/login')
app = FastAPI()
fastapi_users = FastAPIUsers(

View File

@@ -54,7 +54,7 @@ def on_after_forgot_password(user: UserDB, token: str, request: Request):
print(f"User {user.id} has forgot their password. Reset token: {token}")
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl='/auth/jwt/login')
fastapi_users = FastAPIUsers(
user_db, [jwt_authentication], User, UserCreate, UserUpdate, UserDB,

View File

@@ -30,7 +30,7 @@ class JWTAuthentication(BaseAuthentication[str]):
self,
secret: str,
lifetime_seconds: int,
tokenUrl: str = "/users/login",
tokenUrl: str = "/login",
name: str = "jwt",
):
super().__init__(name, logout=False)

View File

@@ -229,7 +229,7 @@ def mock_user_db_oauth(
class MockAuthentication(BaseAuthentication[str]):
def __init__(self, name: str = "mock"):
super().__init__(name, logout=True)
self.scheme = OAuth2PasswordBearer("/users/login", auto_error=False)
self.scheme = OAuth2PasswordBearer("/login", auto_error=False)
async def __call__(self, credentials: Optional[str], user_db: BaseUserDatabase):
if credentials is not None: