https://supertokens.com/ logo
organisations implementation
d

derbernd

04/12/2023, 5:06 PM
Hello to all, I use the email/password login and want to embed users into an organisation based on the domain of the email. Then I want to provide users with different views in the frontend based on the organisation. How can I implement this? Thank You
r

rp

04/12/2023, 5:07 PM
hey @derbernd this requires our multi tenancy feature. We will be launching it very soon (within a month hopefully)
d

derbernd

04/12/2023, 5:08 PM
Okay, good to know! So I wait implementing this feature.
r

rp

04/12/2023, 5:08 PM
but you can sort of do it now as well. Since the org is based on the email's domain, you can still just put all the user's in the same pool
about the frontend being different, you can always build custom components around our pre built one which is based on the domain of the email entered.
you can embed our pre built component in a page and have that page look different for different orgs
d

derbernd

04/12/2023, 5:11 PM
I didn’t find informations on using pools. Where can I find some information?
r

rp

04/12/2023, 5:12 PM
that's not there at the moment (that's the multi tenancy feature i was talking about)
right now all the user's are in the same pool. Uniquely identified by their email ID
but since you are identifying orgs based on email domains, each email will be globally unique anyway
so you don't really need pools
d

derbernd

04/12/2023, 5:13 PM
Ah okay
I would like to continue to store information such as name, phone number and so on per user. Do I prefer to use an external database for this or can I also implement this in Supertokens?
r

rp

04/12/2023, 5:17 PM
you could do that, or you could use our user metadata feature as well.
d

derbernd

04/12/2023, 5:27 PM
Is there an example for using metadata in python (FastAPI)?
for asyncio python:
from supertokens_python.recipe.usermetadata.asyncio import update_user_metadata


async def some_func():
    user_id = "..."

    await update_user_metadata(user_id, {
        "newKey": "data"
    })
for syncio:
from supertokens_python.recipe.usermetadata.syncio import update_user_metadata

user_id = "..."

update_user_metadata(user_id, {
    "newKey": "data"
})
And then you can get the metadata like this:
from supertokens_python.recipe.usermetadata.asyncio import get_user_metadata


async def some_func():
    user_id = "..."

    metadataResult = await get_user_metadata(user_id)
    exampleValue = metadataResult.metadata["exampleKey"]
    print(exampleValue)
Or for syncio, like this:
from supertokens_python.recipe.usermetadata.syncio import get_user_metadata

user_id = "..."

metadataResult = get_user_metadata(user_id)
exampleValue = metadataResult.metadata["exampleKey"]
print(exampleValue)
d

derbernd

04/12/2023, 5:34 PM
Thank you