Sign up and log in#

import lamindb as ln
🔶 You haven't yet setup an instance using the CLI: Please call `ln.setup.init()` or `ln.setup.load()`

Sign up#

Your user account does not yet exist#

You only need to sign up once. For a non-signed-up email, on the CLI, call

!lamin signup testuser1@lamin.ai

and within Python, call

ln.setup.signup("testuser1@lamin.ai")

This prints

Please *confirm* the sign-up email. After that, login with `lamin login testuser1@lamin.ai`!

Generated login password: cEvcwMJFX4OwbsYVaMt2Os6GxxGgDUlBGILs2RyS
Email & password are cached: /Users/testuser1/.lndb/user-testuser1@lamin.ai.env!
Going forward, credentials are auto-loaded. In case of loss, recover your password via email: https://lamin.ai

Your user account exists#

If the user tries to sign up again, an error message is raised:

!lamin signup testuser1@lamin.ai
assert ln.setup.signup("testuser1@lamin.ai") == "user-exists"
❌ User already exists! Please login instead: `lamin login`.

You did not confim the email and try to sign up again#

This raises the following error.

RuntimeError: It seems you already signed up with this email. Please click on the link in the confirmation email that you should have received from lamin.ai.

Depending on timing, it might also raise a 429 Too Many Requests error.

Log in#

Log in with your email:

ln.setup.login(
    "testuser1@lamin.ai", password="cEvcwMJFX4OwbsYVaMt2Os6GxxGgDUlBGILs2RyS"
)  # CLI: lamin login "testuser1@lamin.ai" --password "cEvcwMJFX4OwbsYVaMt2Os6GxxGgDUlBGILs2RyS"
✅ Logged in with handle testuser1 and id DzTjkKse
ln.setup.login(
    "testuser1", password="cEvcwMJFX4OwbsYVaMt2Os6GxxGgDUlBGILs2RyS"
)  # CLI: lamin login testuser1 --password "cEvcwMJFX4OwbsYVaMt2Os6GxxGgDUlBGILs2RyS"
✅ Logged in with email testuser1@lamin.ai and id DzTjkKse

You don’t have to provide your password the second time as it’s cached:

ln.setup.login("testuser1")  # CLI: lamin login testuser1
✅ Logged in with email testuser1@lamin.ai and id DzTjkKse
Hide code cell content
assert ln.setup.settings.user.email == "testuser1@lamin.ai"
assert ln.setup.settings.user.id == "DzTjkKse"
assert ln.setup.settings.user.handle == "testuser1"

import jwt

access_token_payload = jwt.decode(
    ln.setup.settings.user.access_token,
    algorithms="HS256",
    options={"verify_signature": False},
)
assert access_token_payload["email"] == "testuser1@lamin.ai"