diff --git a/test/auth-react-server/main.go b/test/auth-react-server/main.go index 51ad4645..16bf58cb 100644 --- a/test/auth-react-server/main.go +++ b/test/auth-react-server/main.go @@ -92,6 +92,10 @@ func callSTInit(passwordlessConfig *plessmodels.TypeInput) { return saveCode(input.PasswordlessLogin.PhoneNumber, input.PasswordlessLogin.UserInputCode, input.PasswordlessLogin.UrlWithLinkCode, input.PasswordlessLogin.CodeLifetime, input.PasswordlessLogin.PreAuthSessionId, userContext) } + sendPasswordlessLoginEmail := func(input emaildelivery.EmailType, userContext supertokens.UserContext) error { + return saveCode(input.PasswordlessLogin.Email, input.PasswordlessLogin.UserInputCode, input.PasswordlessLogin.UrlWithLinkCode, input.PasswordlessLogin.CodeLifetime, input.PasswordlessLogin.PreAuthSessionId, userContext) + } + if passwordlessConfig == nil { passwordlessConfig = &plessmodels.TypeInput{ SmsDelivery: &smsdelivery.TypeInput{ @@ -99,6 +103,11 @@ func callSTInit(passwordlessConfig *plessmodels.TypeInput) { SendSms: &sendPasswordlessLoginSms, }, }, + EmailDelivery: &emaildelivery.TypeInput{ + Service: &emaildelivery.EmailDeliveryInterface{ + SendEmail: &sendPasswordlessLoginEmail, + }, + }, ContactMethodEmailOrPhone: plessmodels.ContactMethodEmailOrPhoneConfig{ Enabled: true, }, @@ -414,6 +423,7 @@ func callSTInit(passwordlessConfig *plessmodels.TypeInput) { rw.Write(bytes) } else if r.URL.Path == "/beforeeach" && r.Method == "POST" { deviceStore = map[string]CustomDevice{} + callSTInit(nil) rw.WriteHeader(200) rw.Header().Add("content-type", "application/json") bytes, _ := json.Marshal(map[string]interface{}{})