taijuten
07/25/2021, 7:55 PMrp
07/25/2021, 7:55 PMtaijuten
07/25/2021, 7:55 PMrp
07/25/2021, 7:56 PMrp
07/25/2021, 8:10 PMoverride
recipe functions feature on the backend to modify emails by adding the tenantId to them, so that if a user uses the same email across tenants, it will still be unique from the core's point of view. So an email like user@example.com
would be modified to user+tenantId@example.com
taijuten
07/25/2021, 8:11 PMrp
07/25/2021, 8:12 PMtaijuten
07/25/2021, 8:12 PMrp
07/25/2021, 8:12 PMrp
07/25/2021, 8:33 PMemailExistsGET:
- Change the input email to add the tenantId to it before calling the original implementation of this API
generatePasswordResetTokenPOST:
- Change the input formFields' (where id == "email") to add the tenantId to the email
signInUpPOST (type == "emailpassword"):
- Change the input email to have the tenantId before signing in / up.
signInUpPOST (type == "thirdparty"):
- You can copy/paste the whole API's body from our repo, and after getting the user's info from the OAuth provider, you would change the email and thirdPartyId to have the tenantId.
The above would in turn imply that if you fetch user info from Supertokens, you would get their email with the tenantId attached to it. Also, if you want to fetch a user based on their email, you would need to provide the email with their tenantId with it.
If you want SuperTokens to output the emails without the tenantIds, you can overide the recipe functions (the other link I sent), and override all the functions that return a User
object to strip away the tenantId part.
However, if you do that, then you would have to somehow figure out which tenant an email belongs to before using that email to query some info from supertokens. So perhaps it's best to not modify the recipe functions at all.rp
07/25/2021, 8:33 PMtaijuten
07/25/2021, 8:34 PMrp
07/25/2021, 8:36 PMtaijuten
07/25/2021, 8:39 PMsupertokens-node
repo, wondering how much effort it would be to make a supertokens-serverless
fork, without express, and including a Cloudformation with APIGateway or similar to replace the express aspect of it.
Alternatively, I think actually the entire supertokens backend might even be able to sit in a Lambda Layer, so that each Lambda execution should already be initialised beforehand, based on environment variables. This would drastically reduce the cold-start time, if each API endpoint on the backend was an independent lambdataijuten
07/25/2021, 8:41 PMrp
07/25/2021, 8:41 PMtaijuten
07/25/2021, 8:42 PMrp
07/25/2021, 8:42 PMtaijuten
07/25/2021, 8:44 PMrp
07/25/2021, 8:46 PMrp
07/25/2021, 8:47 PMtaijuten
07/25/2021, 8:54 PMrp
07/25/2021, 8:56 PMtaijuten
07/25/2021, 8:56 PMtaijuten
07/25/2021, 8:57 PMrp
07/25/2021, 8:57 PMtaijuten
07/25/2021, 8:58 PMrp
07/25/2021, 9:00 PMrp
07/26/2021, 5:22 AMinit
function just once per lambda function load (which will solve the cold start problem for 15 mins since the lambda function would be alive for 15 mins).
You would instead have to provide some callbacks in the init function which determine the tenant's website domain (for email verification + password reset links). Like here: https://github.com/supertokens/supertokens-auth-react/blob/master/examples/with-one-login-per-subdomain/api-server.jsKillian
08/04/2021, 5:26 AMKillian
08/04/2021, 5:26 AM