Skip to main content
zerotal

Documentation


Documentation / zerotal / auth / MAGIC

Variable: MAGIC

const MAGIC: object

Defined in: packages/auth/src/MagicLinkBroker.ts:15

Typed result constants returned by MagicLinkBroker.

Type Declaration

SENT

readonly SENT: "magic.sent" = "magic.sent"

Magic link sent successfully.

USER_NOT_FOUND

readonly USER_NOT_FOUND: "magic.user_not_found" = "magic.user_not_found"

No user found for the given email.

OK

readonly OK: "magic.ok" = "magic.ok"

Login succeeded.

INVALID

readonly INVALID: "magic.invalid" = "magic.invalid"

Link signature invalid or user not found during login.

Example

import { MagicLinkBroker, MAGIC } from '@zerotal/auth';

const result = await magicLinks.sendLink(email);
if (result === MAGIC.SENT) { ... }
if (result === MAGIC.USER_NOT_FOUND) { ... }