Skip to main content
Function Signature
A PortalAuth method. Returns once Portal has accepted the email for delivery. The sign-in itself completes later, when the user taps the link and your app forwards the redirect URL to handleRedirect. Parameters
  • email: The user’s email address. Trimmed and lowercased before sending, because the backend requires a lowercase address and does not trim.
Throws
  • PortalAuthError.magicLinkNotConfigured: The instance was created without magicLink. Raised before any network call.
  • PortalAuthError.invalidArgument(name: "email"): The address is empty or blank. Raised before any network call.
  • PortalAuthError.rateLimited: Portal returned 429; too many links were sent to this address in the last minute. The SDK never retries on your behalf.
  • PortalAuthError.accountAbstractionUnavailable(message:): isAccountAbstracted: true was requested but gas sponsorship is not enabled for your organization or not configured for the environment.
  • PortalRequestsError.unauthorized: The redirectUrl is not on the environment’s allow list, the fromEmail does not belong to a sending domain enabled for the environment, the templateId does not exist, or the Auth Environment ID does not match an environment with authentication switched on.
  • Other transport errors unchanged.
Notes
  • Every call sends a real email, and sends are rate limited to 10 per address per minute. Never retry automatically; a resend should be an explicit user action, and a short cooldown on the button avoids the rate limit.
  • The link carries a single-use token that expires after 15 minutes. Some email security scanners prefetch links, which can spend the token before the user taps it; handle PortalRequestsError.unauthorized from handleRedirect by offering a new link.
  • Requires a verified sending domain and an email template; see Email magic links.
  • Unlike the other Portal SDKs, the address is lowercased for you, so you do not need to normalize it first.
  • Never log the email address.
  • Available starting from SDK version 8.0.0.
Example Usage
Related Documentation