Suggestions on implementing login flow using management api

Hi,

I’m trying to use the organization feature to achieve login workflow, below is what I want to do:

a user hits the login endpoint on my micro-service which will redirect the user to auth0’s universal login page, the user will provide an organization that s/he wants to join, I need to check if the organization already exists, if so then ad the user to the pending request of the organization and wait for an admin to add the user to that organization. If the organization doesn’t exist yet, create the organization and set the user as admin of that org.

Any suggestions on how I can implement this flow using management api? Or is there other preferred options other than calling management api to achieve this?

Thanks!