Second, you will need to create two routes (after ...
# support-questions
r
Second, you will need to create two routes (after our middleware) like so:
Copy code
js
import ThirdPartyEmailPasswordRaw from "supertokens-node/lib/build/recipe/thirdpartyemailpassword/recipe"

app.use(supertokens.middleware());

app.post("/auth/signup", async (req, res) => {

  let recipeInstance = ThirdPartyEmailPasswordRaw.getInstanceOrThrowError();

  // TODO: This will handle sign up requests from email password login. The body for this can be found here: https://github.com/supertokens/supertokens-node/blob/master/lib/ts/recipe/emailpassword/api/signup.ts
})

app.post("/auth/signinup", async (req, res) => {

    let recipeInstance = ThirdPartyEmailPasswordRaw.getInstanceOrThrowError();

  // TODO: This will handle sign up and in requests from social login. The body for this can be found here: https://github.com/supertokens/supertokens-node/blob/master/lib/ts/recipe/thirdparty/api/signinup.ts
})
- Now you can copy / paste the contents of that file in the above functions, (you will have to figure out imports, but it's possible - can help with that). - Test that these APIs work as expected first. - Then, for the
/auth/signup
API, before calling
signUp
(line 41 in the above file), check if the email exists or not. Likewise, for the
/auth/signinup
API, before calling
signUp
(line 109 in the above file), do the same check. If the email exists in either case, throw an error. Else let the API logic continue. - You will need this object called
recipeInstance
for each of the above functions, which I have defined above in the API functions.