Hey, is there a way to have two different sign-in/...
# support-questions-legacy
p
Hey, is there a way to have two different sign-in/signup forms in the same application? I couldn't find anything in the documentation and with a simple inspection of the code, the SuperTokens class in the Backend SDK seems intended to be used as a Singleton.
r
hey @papajohn3468 Can you elaborate on what you want please? The description is a little too vague
p
Yes, I would like to have two different types of accounts, for example https://example.com/auth_users to login/signup the users & https://example.com/auth_stores to login/signup the stores. Is it possible?
r
It is possible. Will the sign up form have the same set of fields for both these cases? What are the login methods for both of these?
p
No, for the users I would like to use the Social Login + Email Password recipe without any additional field, while for the stores I would like to use the Email Password recipe with some additional fields (like store's location, owners mobile phone etc)
r
right. So in this case, it's best if you build custom components for sign in and sign up. You can reuse our password reset and auth callback components though.
another option is to embed our sign in / up components in two of the pages, and then override the sign up component to render the right sign up form based on the path in the url
p
Actually Im the backend developer of the application,so Im initially concerned with how the backend should work. I can see that we call the SuperTokens init(...) method as a top level statement. Also inside the init(...) method there is a check (if Supertokens.__instance is None:) thus I understand that it is intended to be used as a Singleton. My initial thought was to create two different config files (one for the users and one for the stores) and spin-up two SuperToken core containers, however I dont think that this is possible with the current implementation.
r
you don't need two of them
the same api can be called by both the forms with different inputs
you can override the APIs to check the input and detect which type of user it is
p
Any references to the docs?
r
embedding the sign in up components -> https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/embed-sign-in-up-form overriding the react components to make / add your own -> https://supertokens.com/docs/thirdpartyemailpassword/advanced-customizations/react-component-override/usage Docs for functions to call in your custom sign up form -> https://supertokens.com/docs/thirdpartyemailpassword/custom-ui/email-password-login On the backend, you can override the sign up API this way -> https://supertokens.com/docs/thirdpartyemailpassword/advanced-customizations/apis-override/usage (here you have access to all the fields that user providers from the frontend, using which you can identify which type of user is signing up)
3 Views