Skip to content

Auth API's

All API's used for authentication, authorization, users, ...

/api/v1/auth

Requests

kwai_api.v1.auth.endpoints.login.renew_access_token(request, settings, db, refresh_token, response, x_forwarded_for=None, user_agent='') async

Refresh the access token.

On success, a new access token / refresh token cookie will be sent.

When the refresh token is expired, the user needs to log in again.

kwai_api.v1.auth.endpoints.login.login(request, settings, db, form_data, response, x_forwarded_for=None, user_agent='') async

Login a user.

This request expects a form (application/x-www-form-urlencoded). The form must contain a username and password field. The username is the email address of the user.

On success, a cookie for the access token and the refresh token will be returned.

kwai_api.v1.auth.endpoints.login.logout(settings, db, response, refresh_token=None) async

Log out the current user.

A user is logged out by revoking the refresh token. The associated access token will also be revoked.

This request expects a form (application/x-www-form-urlencoded). The form must contain a refresh_token field.

Even when a token could not be found, the cookies will be deleted.

kwai_api.v1.auth.endpoints.login.recover_user(db, publisher, email) async

Start a recover password flow for the given email address.

A mail with a unique id will be sent using the message bus.

This request expects a form (application/x-www-form-urlencoded). The form must contain an email field.

Note

To avoid leaking information, this api will always respond with 200

kwai_api.v1.auth.endpoints.login.reset_password(uuid, password, db) async

Reset the password of the user.

Http code 200 on success, 404 when the unique id is invalid, 422 when the request can't be processed, 403 when the request is forbidden.

This request expects a form (application/x-www-form-urlencoded). The form must contain an uuid and password field. The unique id must be valid and is retrieved by [/api/v1/auth/recover][post_/recover].

kwai_api.v1.auth.endpoints.user.get(user=Depends(get_current_user))

Get the current user.

/api/v1/auth/users

Requests

kwai_api.v1.auth.endpoints.user_invitations.create_user_invitation(user_invitation_document, db=Depends(create_database), user=Depends(get_current_user), publisher=Depends(get_publisher)) async

Create a user invitation.

A wrong email address or a still pending user invitation will result in a 422 status code.

kwai_api.v1.auth.endpoints.user_invitations.delete_user_invitation(uuid, db=Depends(create_database), user=Depends(get_current_user)) async

Delete the user invitation with the given unique id.

kwai_api.v1.auth.endpoints.user_invitations.get_user_invitations(pagination=Depends(PaginationModel), db=Depends(create_database), user=Depends(get_current_user)) async

Get all user invitations.

Use the page[offset] and page[limit] query parameters to get a paginated result.

kwai_api.v1.auth.endpoints.user_invitations.get_user_invitation(uuid, db=Depends(create_database), user=Depends(get_current_user)) async

Get the user invitation with the given unique id.