AldrazA
ZITADELโ€ข15mo agoโ€ข
18 replies
Aldraz

No verification e-mail before actual changing of the e-mail

Hey! I am trying to follow several versions of the API and none of them seems to send the user a verification code (+ link) when I use the API to change the e-mail. Basically it just applies and saves the changes into Zitadel directly without asking the user, which is my main issue. Is this mechanism something that I need to do manually, like generate a custom code and e-mail and ask the user for confirmation in my app? Or do I need to use and setup the OTP Email? Thanks for help!

import requests
import json

url = "https://$CUSTOM-DOMAIN/v2/users/:userId/email"

payload = json.dumps({
  "email": "mini@mouse.com",
  "sendCode": {
    "urlTemplate": "https://example.com/email/verify?userID={{.UserID}}&code={{.Code}}&orgID={{.OrgID}}"
  },
  "returnCode": {},
  "isVerified": True
})
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer <TOKEN>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
Was this page helpful?