vaphes / pocketbase

PocketBase client SDK for python
https://pypi.org/project/pocketbase/
MIT License
359 stars 41 forks source link

authentication not working... #14

Closed avnav0 closed 1 year ago

avnav0 commented 1 year ago
import pocketbase
import os
import dotenv

dotenv.load_dotenv()

async def export_func(data: str | None = None):
    pb = pocketbase.PocketBase('http://localhost:8090/')
    authData = pb.admins.auth_via_email(
        email=os.environ["POCKET_ADMIN"],
        password=os.environ["POCKET_ADMIN_PASS"])
    return await authData

auth = asyncio.run(export_func())
print(auth)

getting pocketbase.client.ClientResponseError: Response error. Status code:404

in the ui:

{ "errorDetails": "", "errorMessage": "Not Found" } --
kiliangui commented 1 year ago

This api end point was removed from pocketbase. You need to take an older version of pocket base OR use the new version of the python sdk .

With the new SDK, you need to use the new endpoint to login to your admin. pb.admins.auth_with_password(email,password)

Hope it help you

avnav0 commented 1 year ago

helps very much, i wasn't aware of a new python sdk??

dsm-72 commented 1 year ago

@ichunichu same here. I am using 0.2.2 which is the latest version of your sdk >.<

dsm-72 commented 1 year ago

@ichunichu see https://github.com/vaphes/pocketbase/blob/master/pocketbase/services/admins.py#L45

dsm-72 commented 1 year ago

@ichunichu can we get a bump on https://github.com/vaphes/pocketbase/pull/16#pullrequestreview-1248419221

kiliangui commented 1 year ago

The new sdk is a beta version : https://github.com/vaphes/pocketbase/releases/tag/v0.3.0-beta It is not on pipy yet, but you still can install it

Vrajs16 commented 1 year ago

As @ichunichu mentioned, you can compile the source code using python poetry by downloading the tar and then running the following inside the directory until it is published to Pypi:

# Install poetry on mac
$ brew install poetry

# Install dependencies
$ poetry install

# Build package
$ poetry build

# Add pocketbase to pip
$ pip install dist/pocketbase*.whl 

And then your good to go!

m29h commented 1 year ago

closing this issue as it is long solved in the current release v0.8.2