跳到主要内容

Custom sign-in experience error pages

During the sign-in flow, end users may sometimes see default error pages. Common scenarios include:

  • Expired sessions: The user took too long to sign in, and the session timed out.
  • Directly visiting the sign-in URL: The user opens a bookmark or shares /sign-in URL (bypassing the normal sign-in button).
  • Non-existent routes: The user navigates to a path that doesn’t exist in your auth flows.
  • Social sign-in callback issues: The social session is not found in a social callback page.
  • Invalid magic links: A one-time token (magic link) for things like organization invitation or passwordless sign-in has expired or consumed.

By default, Logto will show a generic error page (e.g., a 404 “unknown session” page) in these scenarios. To improve the end-user experience when encountering errors, you need to set up the following parameters:

  • Unknown session redirect URL: A fallback URL to send users to when their session is not found.
  • Support email & Support website: Contact information shown on error pages.

Unknown session redirect URL

Logto uses the OpenID Connect (OIDC) flow for authentication. A valid OIDC authorization flow must be initiated by your application, e.g, clicking your app’s “Sign in” button sends an OIDC authorization request to Logto, which then sets up a secure session (cookie).

However, if a user directly accesses /sign-in, bypassing session validation, it causes "unknown session" 404 errors when:

  • Sessions expire
  • Users bookmark/share sign-in links
  • Authorization context is missing

To handle this, Logto introduced an unknownSessionRedirectUrl setting. When you set this URL, Logto will automatically redirect users to the specified page to reinitiate a new sign-in flow instead of showing the 404 error.

How to set it up:

  1. Go to Console > Sign-in experience > Sign-up and sign-in > Advanced settings
  2. Set the "Unknown session redirect URL" to your service address or product’s homepage. E.g., Logto Cloud will set "https://cloud.logto.io".

Support contact info

If other errors occur (such as visiting an invalid path, a social callback with no session, or opening an expired magic link), Logto will show a default error page. To help users, you can display contact information on these unavoidable error pages.

Authentication error pages with support contact info

How to set it up:

  1. Go to Console > Sign-in experience > Content > Support
  2. Set your support email address
  3. Set your support or official website URL

This ensures that even when something goes wrong, users have a clear way to get help.