Request for Example with Ash Multitenant & Authentication

Hi all,

I am looking for an example that demonstrate how to build a Phoenix app using Ash multi tenant with separate schema and Ash authentication for authentication.

Any Git repo or sample code I can refer to?

2 Likes

The setup for ash_authentication should be the same regardless of if you are using multitenancy or not. Is there a particular part of it that is not working as expected?

Thank you for the reply, @zachdaniel. I am yet to figure out how to have a context multi-tenant application with centralized users, organisations, and user_organisations tables while other tables are within the tenant schema, so that the following flow can be achieved:

  1. User registers.
  2. User creates an organisation as the owner.
  3. The system creates the organisation and automatically runs organisation migrations.
  4. When the user signs in, they are redirected to the organisation based on the current_organisation_id value in the users table.

1 Like

My issue was resolved. I will soon be writing a post about the same.

7 Likes

Have you ever done that post?

2 Likes

Yes. See: https://medium.com/@lambert.kamaro/part-17-access-group-and-permissions-ui-36ca7bf5fb49

You may want to start from part 14.

4 Likes

I forgot you have that whole course!
I’ve started going through it as i actually need posts in my own product!

1 Like