Hosted pages
Ready-made sign-in and sign-up pages served on your own domain, with no UI code.
Hosted pages
Every project with auth enabled gets complete sign-in and sign-up pages at:
https://<your-domain>/_ploy/auth/sign-in
https://<your-domain>/_ploy/auth/sign-upThey work with any framework, including static sites, because they need no package and no JavaScript in your app. They run on your own domain, so there is no redirect to a third-party login domain and the session cookie is set directly for your app.
Use them
Link to the page with the path to return to after sign-in:
<a href="/_ploy/auth/sign-in?redirectTo=/dashboard">Sign in</a>After a successful sign-in or sign-up the user lands on redirectTo with a ploy_session cookie. Users who are already signed in are sent straight to redirectTo. To reconnect a provider or approve additional scopes, navigate directly to /_ploy/auth/oauth/<provider>?redirectTo=<path> instead of the hosted sign-in page. Provider access tokens remain server-only.
redirectTo accepts a path or a URL on your app's origin. With shared sessions, it also accepts sibling origins on the same scheme and port. Anything else falls back to /. For sign-in hosted on another subdomain, send an absolute return URL to your app.
To sign out, POST to /_ploy/auth/signout.
What they show
The pages follow your project's sign-in methods: Google, Apple, and GitHub buttons, passkeys, the email and password form, and Email me a sign-in link or Email me a sign-in code, each only when enabled. Require name adds a name field to sign-up, and when sign-ups are off the sign-up page says so.
The heading shows your project name. Pages follow the visitor's light or dark system preference.
If a social sign-in fails, the user returns to the page with the reason shown, for example when they cancel at the provider.
Forgot password
When password sign-in is on and auth emails are enabled, the sign-in page links to Forgot password?. Two more pages handle the reset:
https://<your-domain>/_ploy/auth/forgot-password?redirectTo=/dashboard
https://<your-domain>/_ploy/auth/reset-password?token=...The first asks for the email address and sends a reset link; the second, opened from that link, sets the new password and returns to sign-in. When email verification is required, sign-up tells the user to check their inbox and sign-in offers Resend verification email. See Emails, sign-in links and passwords.
Sign-in links
When sign-in links are on and auth emails are enabled, the sign-in page offers Email me a sign-in link next to the password form; without password sign-in it is the form's main button. The user enters their email, gets a link valid for 15 minutes, and opening it shows a confirmation page:
https://<your-domain>/_ploy/auth/magic-link/verify?token=...Its Continue as button finishes the sign-in and returns to redirectTo. For a new address the link creates the account when sign-ups are allowed; with Require name, the sign-in page asks for the name first.
Sign-in codes
When sign-in codes are on, the sign-in and sign-up pages offer Email me a sign-in code (or Email me a sign-in link when links are on too, and the email then carries both). After the user enters their email, the page switches to a code field. Typing or pasting the 6-digit code signs the user in and returns to redirectTo; Use a different email goes back.
Security
- Every page is self-contained: no external scripts, styles, or fonts.
- A strict Content Security Policy with a per-request nonce blocks injected scripts, and
frame-ancestors 'none'prevents clickjacking. - Responses are
no-store, so sign-in pages are never cached by a CDN.
Want the forms inside your own layout instead? Use the React components, which show the same methods.
With Next.js
protect() and authMiddleware from @meetploy/nextjs redirect signed-out users to the hosted sign-in page by default.
Lifecycle hooks
Hosted forms invoke the same auth lifecycle hooks as custom UIs. JSON password/passkey/email-code flows return before-hook errors with 403 (refused) or 503 (failed); magic-link and OAuth browser callbacks redirect with ploy_auth_error. Messages render as text, not HTML.
Local development
ploy dev serves the same pages from the local emulator. With Next.js and initPloyForDev(), the helpers point at the emulator automatically. Verification, sign-in link and code, and reset emails land in the dev dashboard under Auth → Emails.
How is this guide?
Last updated on
Authentication
Add managed sign-in with email and password, email sign-in links, passkeys, and Google, Apple, or GitHub to your applications with Ploy Auth.
Emails, sign-in links and passwords
Verify users' email addresses, sign them in with a one-time email link or code, let them reset or change their password, customize the emails, and choose the address Ploy Auth sends from.