Steps to reproduce:
- Deleted all Stytch users and populated an environment with users using a the script below
- At this point, all users in Stytch had been created with today’s date
- Attempted log-in using a user that exists in Stytch
- Received an email about “creation request”
- Did not click on the link. Went straight to User Management console, and there are two users with the given email. The new user is backdated, maybe to the first date I used that email to login using Stytch.
This looks to me like a bug with Stytch. But maybe I am making the wrong assumptions? Happy to provide details about the environment / user in private if it helps debugging
Note: this does not happen all of the time. There is a non-deterministic element to it.
Migration script:
with open('/tmp/users.csv') as csvfile:
csvreader = csv.reader(csvfile)
# skip header
next(csvreader)
for row in csvreader:
name = row[0]
email = row[1]
names = name.split(" ")
first_name = names[0]
last_name = ' '.join(names[1:])
stytch_name = Name()
stytch_name.first_name = first_name
stytch_name.last_name = last_name
print(
f"Creating first_name={first_name}, last_name={last_name}, email={email}")
try:
client.users.create(email=email, name=stytch_name,
create_user_as_pending=False)
except StytchError as error:
# Handle Stytch errors here
if error.details.error_type == "duplicate_email":
# hopefully does not happen in prod
print(
f"Duplicate email (caused by case sensitivity in older versions of our apps) first_name={first_name}, last_name={last_name}, email={email}")