How to let 2 types of users to login to my app - customers and businesses
I'm using Clerk rn but I'm down to switch to NextAuth if it works better for this.
I just want to let customers and businesses sign up to this website - and they see different stuff when they login. I ask businneses more questions on signup and store that in a table (customer data on another table)
How would I even manage this? Do I let states manage this? (don't think this is correct)
5 Replies
maybe with the clerk user metadata you can create a role or type for customer/business
Could you explain in a little more detail?
User metadata | Clerk
User objects hold a set of metadata that can be used internally to store arbitrary information.
https://discord.com/channels/966627436387266600/1096538539895836803/1096578348060262431
then, on the frontend you can get the user's role and display the corresponding component/page
You may add a role attribute to your user model in your database as string like 'customer' | 'business'. When a user is authenticated you can show the views according to this attribute. This approach works well with next-auth. At least this would be a more common version of authorization.