Skip to content
SupportDashboard

Anonymous Sign-In

Learn how to let users try your application without creating an account, and how to convert them to permanent users.

anonymous guest temporary user deanonymize convert account passwordless SMS phone number

Anonymous sign-in creates a temporary user without requiring any credentials. This is useful for allowing users to try your application before committing to an account.

await nhost.auth.signInAnonymous();

Anonymous users can be converted to permanent accounts by linking an email address or a phone number.

The email deanonymization flow follows the same PKCE pattern as sign-up, using deanonymizeUser:

import { generatePKCEPair } from '@nhost/nhost-js/auth';
const { verifier, challenge } = await generatePKCEPair();
localStorage.setItem('nhost_pkce_verifier', verifier);
// Deanonymize with email + password
await nhost.auth.deanonymizeUser({
signInMethod: 'email-password',
email: 'joe@example.com',
password: 'secret-password',
options: {
redirectTo: `${window.location.origin}/verify`,
},
codeChallenge: challenge,
});
// Or deanonymize with passwordless email (magic link)
await nhost.auth.deanonymizeUser({
signInMethod: 'passwordless',
email: 'joe@example.com',
options: {
redirectTo: `${window.location.origin}/verify`,
},
codeChallenge: challenge,
});

After the user verifies their email, the authorization code is exchanged for a session.

Both email pathways require PKCE via the codeChallenge parameter when email verification is required.

SMS deanonymization links a phone number without a codeChallenge. Requesting deanonymization stages the new phone number and user options while the user remains anonymous. The conversion completes through /signin/passwordless/sms/otp: after the OTP is verified, the staged options are applied and a non-anonymous session is returned.