I am trying to implement a simple user invitation with the help of Send Email Invitations for Application Signup . I want to avoid sending out the link myself, as we use the Auth0 templates for every other mail.
I am running both these methods and am getting 201 as status code, but there is no email send. Please note that I am using our test tenant for this, which uses the default email settings of auth0.
def invite_user(email: str) -> dict:
re = requests.post(
f"https://{AUTH0_DOMAIN}/api/v2/users",
headers={"Authorization": f"Bearer {get_management_token()}"},
json={
"email": email,
"email_verified": False,
"connection": "Username-Password-Authentication",
"password": "Start123#", # TODO: Generate safe throw-away password
"verify_email": False,
},
)
if re.status_code != 201:
raise HTTPException(re.status_code, re.json())
return re.json()
def password_change_ticket(email: str) -> dict:
re = requests.post(
f"https://{AUTH0_DOMAIN}/api/v2/tickets/password-change",
headers={"Authorization": f"Bearer {get_management_token()}"},
json={
"client_id": AUTH0_CLIENT_ID,
"connection_id": AUTH0_CONNECTION_ID,
"email": email,
},
)
if re.status_code != 201:
raise HTTPException(re.status_code, re.json())
return re.json()
As far as I can see, the ticket is created and the link can be used, there are no errors in the auth0 log, so I am curious of what I am doing wrong?