Prove an existing email account
This API and SDK are in development and require deployment and package publication before use. Your app hosts its public account-deletion page. Configure that page's origin and an environment-bound publishable key with identity:auth. Keep secret keys out of the page.
First check for an unresolved deletion request in the original account's local scope. If one exists, recover it using its original receipt pair, without starting another email sign-in. Follow Delete an app user account.
For a new request, use the isolated existing-only client with your app's trusted Mocco project UUID:
import { createExistingEmailIdentityClient } from '@mocco/sdk-core/identity-existing-email';
const email = createExistingEmailIdentityClient({
publishableKey: 'YOUR_ENVIRONMENT_PUBLISHABLE_KEY',
projectId: 'YOUR_PROJECT_UUID',
});
const challenge = await email.emailStart(addressFromThePerson);
const transientSession = await email.emailVerify(challenge.challengeId, codeFromThePerson);Keep this session transient. It authenticates the person for your explicit deletion confirmation; it is not the app's usual persistent sign-in. If they cancel, call email.logout(transientSession.refreshToken) and discard the session. Handle logout errors without reporting that an account was deleted. Do not send tokens, email or codes to analytics or logs.
The server captures the account when issuing the code. Unknown email still has the same start response, but verification creates no account. A deleted user, a changed address or another account that later reused the email cannot take over that proof. A session from another project is refused by the client. The code expires after 10 minutes and allows five guesses. Normal and existing-only paths share request quotas; honor Retry-After.
An older server may return 404. Show that this authentication flow is unavailable; never fall back to the ordinary signup-capable email paths. A lost verification response is an authentication error, not a deletion result. The client does not retry or persist anything. Once deletion has been initiated, retain the original persisted receipt and recover its outcome without another login. A missing or expired receipt does not prove completion.
Email-only support does not prove that social-only app users have a usable deletion path. Confirm your actual app's account methods, cancellation, response loss, reload and store resources before enabling accounts. Mocco does not host this page for your app.