From 7bb6e978801d734db1f81cdb04f3673196e702a3 Mon Sep 17 00:00:00 2001 From: Heri Hermawan Date: Sat, 14 Jan 2023 03:24:55 +0700 Subject: [PATCH] Update: auth url and parameter for Admins (#16) Co-authored-by: Heri Hermawan --- README.md | 2 +- pocketbase/services/admins.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ea0d80..4599b45 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ result = client.records.get_list( user_data = client.users.auth_via_email("test@example.com", "123456") # or as admin -admin_data = client.admins.auth_via_email("test@example.com", "123456") +admin_data = client.admins.auth_with_password("test@example.com", "123456") # and much more... ``` diff --git a/pocketbase/services/admins.py b/pocketbase/services/admins.py index c97705c..7d68980 100644 --- a/pocketbase/services/admins.py +++ b/pocketbase/services/admins.py @@ -31,7 +31,7 @@ class Admins(CrudService): self.client.auth_store.save(token, admin) return AdminAuthResponse(token=token, admin=admin, **response_data) - def auth_via_email( + def auth_with_password( self, email: str, password: str, body_params: dict = {}, query_params: dict = {} ) -> AdminAuthResponse: """ @@ -40,9 +40,9 @@ class Admins(CrudService): On success this method automatically updates the client's AuthStore data. """ - body_params.update({"email": email, "password": password}) + body_params.update({"identity": email, "password": password}) response_data = self.client.send( - self.base_crud_path() + "/auth-via-email", + self.base_crud_path() + "/auth-with-password", { "method": "POST", "params": query_params,