Assigning roles with Custom auth provider

I’m using the Custom auth provider.

  1. How do I assign users to a Role?
  2. Can I assign a role when I call createPlasmicAppUser ?
  3. Can I assign roles programmatically using an API?
  4. Can I create a role programmatically using an API?

You can use the Auth Settings in plasmic studio to assign roles to an user, currently there is now way to programmatically or through createPlasmicAppUser assign roles to users. In the Auth Settings, you can create groups or assign roles to domains which can help you out.

So if I have thousands of users my only option is to manually edit them using the user interface? That is impossible.

Can you document and expose the <https://studio.plasmic.app/api/v1/end-user/> and <https://studio.plasmic.app/api/v1/app-auth> that the studio is calling to perform the user and role actions?

Yeah, it’s a current limitation of auth, currently you can compose an app with auth if you can express in a small set of rules that define which users/domains have some role, you can allow multiple users in your project by using the General Access rule, but if you want to have a arbitrary way to define roles to users that can’t be expressed in the app auth settings using custom auth, you aren’t able to.

Could you give me more context on how you plan to use auth in plasmic ?

I’m using Strapi as a backend. It already has Users and Roles. My hope was to be able to use the <https://studio.plasmic.app/api/v1/end-user/> and <https://studio.plasmic.app/api/v1/app-auth> apis to keep the two user and role sets in sync. So when I create a user account and assign a role in strapi it would create the same user and assign the same role in Plasmic.

It will make it easy to control what my users can see because I can use the build in Plasmic auth to create variants and toggle visibility.

It seems like everything I need is already in those APIs, they’re just undocumented and perhaps secured in a way that I can’t use them.