Auth Functions

class ai.backend.client.func.auth.Auth

Provides the function interface for login session management and authorization.

classmethod await login(user_id, password, otp=None)

Log-in into the endpoint with the given user ID and password. It creates a server-side web session and return a dictionary with "authenticated" boolean field and JSON-encoded raw cookie data.

This SDK function works when env var BACKEND_ENDPOINT is endpoint of webserver, not manager. If you want to use SDK funcs that send requests to the Manager with login, update the cookie in the session context manager object and save the state with a file. See the example in src/ai/backend/client/cli/config.py login function.

반환 형식:

dict

classmethod await logout()

Log-out from the endpoint. It clears the server-side web session.

This SDK function works when env var BACKEND_ENDPOINT is endpoint of webserver, not manager.

반환 형식:

None

classmethod await update_password(old_password, new_password, new_password2)

Update user’s password. This API works only for account owner.

반환 형식:

dict

classmethod await update_password_no_auth(domain, user_id, current_password, new_password)

Update user’s password. This is used to update EXPIRED password only. This function fetch a request to manager.

반환 형식:

dict

classmethod await update_password_no_auth_in_session(user_id, current_password, new_password)

Update user’s password. This is used to update EXPIRED password only. This function fetch a request to webserver.

반환 형식:

dict