Generate Magic Links for Your Users in Experience Cloud
In the ever-evolving digital landscape, user experience remains paramount, and simplifying authentication is crucial for engagement. Sometimes, when sending an email to a customer, you want to skip authentication and open the desired page straight away. That is where magic links help.
What are magic links?
A magic link — also known as a one-time login (OTL) or passwordless login link — is a unique, time-sensitive URL sent to a user's registered email address as a secure means of authentication. When clicked, it logs the user into their account without a password.
How to generate them in Experience Cloud
The most common approach uses a custom object to manage a token. The magic link carries that token and points to a public page with an Apex controller that validates it, then creates the user session. This means you own token generation, expiry and invalidation — and must handle cleanup of unused tokens.
The article walks through the implementation details, including the controller logic, session creation and the guardrails needed to keep single-use links genuinely single-use.