logto

Application

logto-io/logto

Open-source authentication and authorization infrastructure for SaaS and AI apps.

Overview

Logto is a modern open-source auth solution built on OIDC and OAuth 2.1. It provides multi-tenancy, enterprise SSO, RBAC, and customizable sign-in flows. Designed for scaling SaaS, AI, and agent-based platforms.

README Preview

\n  \n    \n      \n      \n      \n    \n  \n\n\n[](https://discord.gg/vRvwuwgpVX)\n[](https://github.com/logto-io/logto/actions?query=branch%3Amaster)\n[](https://github.com/logto-io/logto/releases)\n[](https://app.codecov.io/gh/logto-io/logto)\n[](https://cloud.logto.io/?sign_up=true&utm_source=github&utm_medium=repo_logto)\n[](https://gitpod.io/#https://github.com/logto-io/demo)\n[](https://render.com/deploy?repo=https://github.com/logto-io/logto)\n\n# Logto\n\n**Logto is the modern, open-source auth infrastructure for SaaS and AI apps.**\n\nIt takes the pain out of OIDC and OAuth 2.1 and makes it easy to build secure, production-ready auth with multi-tenancy, enterprise SSO, and RBAC.\n\n\n  website •\n  cloud •\n  docs •\n  api •\n  blog •\n  auth wiki •\n  newsletter\n\n\n\n\n## Why Logto?\n\nBuilt for teams scaling SaaS, AI, and agent-based platforms without the usual auth headaches.\n\nWith Logto, you get:\n\n- **Multi-tenancy, enterprise SSO, and RBAC**: ready to use, no workarounds.\n- **Pre-built sign-in flows**, customizable UIs, and SDKs for 30+ frameworks.\n- **Full support for OIDC, OAuth 2.1, and SAML** without the protocol pain.\n- **Works out-of-the-box for Model Context Protocol and agent-based AI architectures**.\n\n[🗺️ See all features →](https://docs.logto.io/?ref=readme)\n\n## Get started\n\nPick your path:\n\n- [**Logto Cloud**](https://cloud.logto.io/?sign_up=true&ref=readme): The fastest way to try Logto. Fully managed, zero setup.\n- [**Launch Logto in GitPod**](https://gitpod.io/#https://github.com/logto-io/demo): Start Logto OSS in seconds.\n\n  Wait for the message `App is running at https://3002-...gitpod.io`, then click the URL starting with `https://3002-` to continue.\n\n- **Local development:**  \n\n  ```bash\n  # Using Docker Compose(requires Docker Desktop)\n  curl -fsSL https://raw.githubusercontent.com/logto-io/logto/HEAD/docker-compose.yml | \\n  docker compose -p logto -f - up\n  \n  # Using Node.js (requires PostgreSQL)\n 

FAQ (5)

Troubleshooting
How to fix TS1308 "await isn't allowed in non-async function" in the Logto Next.js App Router Home component?

Mark the Home component as async because it uses await getLogtoContext():

const Home = async () => {
  const { isAuthenticated, claims } = await getLogtoContext(logtoConfig);
  // ...
};

export default Home;

Then run npm run build again. The incorrect non-async example in the Logto Console guide was fixed by PR #9692; update Logto if the guide still shows const Home = () => {.

GitHub Issue #9691
Troubleshooting
How do I fix the redirect_uri 400 error when connecting Logto MCP through Cloudflare Zero Trust MCP Server Portal?

Logto Cloud now supports OAuth Client ID Metadata Documents. Configure the Cloudflare MCP gateway as follows:

1. Host a client metadata JSON file at a public HTTPS URL, for example https://example.com/logto-mcp-client.json:

{
  "client_name": "Cloudflare MCP Gateway",
  "redirect_uris": [
    "https://oauth-callbacks.cloudflareaccess.com/cdn-cgi/access/outbound-oauth-callback"
  ],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "scope": "openid",
  "token_endpoint_auth_method": "none"
}

2. In the Cloudflare MCP Server Portal OAuth configuration, set the client ID to the full URL of that metadata document.
3. Connect to https://mcp.logto.io again. Logto will fetch the document and accept the gateway callback listed in redirect_uris.

Verify support with:

curl https://auth.logto.io/oidc/.well-known/openid-configuration

The metadata should include "client_id_metadata_document_supported": true. Do not use the built-in mcp-client ID for Cloudflare because it is restricted to localhost redirect URIs.

GitHub Issue #9689
Troubleshooting
How do I fix 'session.identifier_not_found' after clicking 'Bind and continue' during social sign-up in Logto?

This is fixed by Logto PR #9593. Upgrade to a release containing that fix. The bug occurs in packages experience/src/containers/VerificationCode/use-continue-flow-code-verification.ts: the link_social branch offers account linking without first calling isVerificationCodeEnabledForSignIn(type). The patched code only shows the link modal when the identifier can sign in with a verification code; otherwise it shows the normal "identifier already exists" message and returns the user to change it. As a temporary workaround on Logto 1.42.0, remove the conflicting phone secondary-identifier requirement, or enable phone verification-code sign-in. Note that phone verification-code sign-in cannot be enabled while PhoneVerificationCode is configured as an MFA factor, so it must be removed from MFA first.

GitHub Issue #9592
how_to
How can I force the Logto sign-in page to use light or dark mode from my application?

Pass the theme authentication parameter with light or dark when initiating the Logto sign-in flow, e.g. extraParams: { theme: 'dark' }, or add theme=dark to the OIDC authorization URL. When dark mode is enabled in Logto, this parameter overrides the default/OS theme; if dark mode is disabled, the parameter is ignored. This support was added in PR #9645.

GitHub Issue #9512
Troubleshooting
How do I stop Logto from sending verification codes to emails outside the sign-up allowlist?

This occurs on Logto's unified sign-in/registration form. Before the code is verified, Logto cannot distinguish whether the email belongs to an existing sign-in account or a new registration, and rejecting it earlier could expose whether an account exists. The allowlist is still enforced after verification, so a disallowed email cannot complete registration.

To reject disallowed emails before a verification code is sent, use the explicit sign-up/register flow, which already performs the allowlist check before invoking the email connector. If the check is required on the unified sign-in path as well, upgrade to a release containing the PR fix(core): check the email allowlist before sending a sign-up sign-in code, or cherry-pick that change in a self-hosted build and rebuild Logto. After upgrading, verify the fix by submitting a non-allowlisted address: the verification-code request should fail immediately and no email should be sent.

GitHub Issue #9690