Skip to main content
Choose Omh Native Auth for managed email and password sign-in on approved projects. You can also run Better Auth, connect your own WorkOS tenant, or integrate another compatible provider. Your ohmyho.st login authorizes hosting operations. A public app can run without an application login.

Set up Omh Native Auth

Omh Native Auth manages application users and sessions for projects approved for the Native Auth rollout. Start with a Paid project, a verified application identity, and your own verified sender authorized for the project. The application identity and sender must share the same registrable main domain. See email and application identity and shared senders. Native Auth management requires CLI and local MCP version 0.1.50 or newer.
  1. Set auth.provider: omh-native in ohmyhost.yaml:
  2. As a project Owner, select Dev or Prod. Read the current configuration with MCP native_auth_config_get, then use native_auth_config_set to enable Native Auth, choose open or invite-only signup, and set the application name, approved HTTPS origin and application paths. Include reset and invitation paths in the allowed redirect list. Follow the MCP configuration workflow.
  3. Build your sign-in and email verification screens with createNativeAuthBrowser from @ohmyhost/customer-runtime/auth-browser. Call signIn.email and signOut from the browser. Native Auth serves the same-origin /api/auth/v1 namespace. Keep that namespace reserved for it.
  4. Protect server routes with createNativeAuthServer(env.OHMYHOST_AUTH) from @ohmyhost/customer-runtime/auth-server. Call getSession(request) or requireUser(request), then check the user’s permissions for the requested record or action. Static files remain public.
  5. Deploy to Dev and read readiness again. The first Native-capable deployment provisions Auth storage. Check that paid, sender, origin and storage are all ready. Exercise sign-up or invitation, email verification, sign-in, a protected action, reload and sign-out on the deployed origin. Confirm that protected access is denied after sign-out. Configure Prod separately and repeat the checks on its own origin.
If the deployment plan or deployment request returns native_auth_launch_unavailable (HTTP 409), ask ohmyho.st support to check rollout access for your workspace and project. If access changes after a deployment is accepted, its operation can fail with the same code before database provisioning starts. After support confirms access, plan the saved commit again and check readiness for the selected environment. Native Auth uses a separately metered Auth database, with separate Dev and Prod user directories even when the application shares business data. A business database is optional. For signup, verification and password-reset mail requests, generate an operation key with createNativeAuthIdempotencyKey from @ohmyhost/customer-runtime/auth-browser. Send it as the Idempotency-Key header in the client fetch options and reuse the same key after an uncertain result.

Add Google or GitHub to Omh Native Auth

Project Owners can enable Google and GitHub separately on approved Native Auth projects. Use your own Google Cloud or GitHub OAuth app for each environment.
  1. Read native_auth_provider_get for google or github with the selected project and environment IDs. Copy the returned callbackUrl. It ends in /api/auth/v1/callback/google or /api/auth/v1/callback/github. If it is null, configure the approved canonical origin in Native Auth first.
  2. For Google, configure the consent screen and audience in Google Auth Platform. Create a Web application OAuth client and paste the exact URL under Authorized redirect URIs. Add test users when the app is in testing and complete Google’s applicable brand verification.
  3. For GitHub, open Settings → Developer settings → OAuth Apps → New OAuth App. Set Homepage URL to the same environment’s app URL. Paste the full URL returned by Native Auth into Authorization callback URL. See GitHub OAuth app setup.
  4. Ask your agent to read the current Native Auth configuration revision and prepare the provider credential handoff using native_auth_provider_secret_input_request with the Client ID and enabled: true. In connected MCP, enter the Client Secret in the protected portal while signed in as the account connected to the agent. In local MCP, pass it to the returned CLI command through stdin. Read back the provider settings. See the MCP workflow.
  5. From the app’s button, call the Native browser client’s signIn.social with the provider and an approved app return path such as /login. To navigate explicitly, pass disableRedirect: true and navigate to the URL in the successful response. Test the provider prompt, callback, protected access and logout on the deployed origin. Configure and test Prod with its own OAuth client ID, secret and callback.
To enforce a verified user’s row permissions in PostgreSQL, use backend row-level security. Validate the server session before calling database.withRls; pass only selected authorization claims from trusted membership or administrator data. Application auth and RLS remain explicit choices, and authentication tables are not automatically protected.

Choose the integration your app already uses

Better Auth has retained integration proof; customer-owned WorkOS Next.js has hosted proof. Other framework/provider combinations need their own verification. Any other OAuth or OIDC provider is hosted the same way as an ordinary application dependency, without a completed support claim. Support is checked against the actual framework, runtime, secrets and callback behavior. Read the returned compatibility result; one verified framework combination does not establish every combination.
  • Better Auth: keep its server handler, schema and base URL in the supported app runtime.
  • WorkOS: use your application’s own client ID, private server key where needed, callback URL and logout URL.
  • Other providers: use the application type matching your architecture; public clients cannot hold a client secret, and server SDKs read their private values from runtime secrets.
For application-owned Better Auth with auth.provider: none, use an application secret such as APP_AUTH_SECRET and pass it explicitly to Better Auth’s secret option. BETTER_AUTH_SECRET is reserved for the optional platform-managed integration; the customer secret command intentionally rejects that name. Keeping your own auth does not select managed mail or auth. To choose the managed bridge, set auth.provider: better-auth and database.enabled: true, and pin Better Auth exactly to 1.7.7. Managed mail is optional for existing verified-user sign-in, sessions and token validation. The managed bridge’s verification/reset send actions use ohmyho.st Mail and need mail.enabled: true, Paid access and your verified sender. For your own Resend callback or sender, keep an application-owned Better Auth handler with auth.provider: none; this leaves Better Auth and application login enabled. SDK package detection alone enables no capability. The platform supplies the managed BETTER_AUTH_SECRET and BETTER_AUTH_URL. The public @amerged/ohmyhost-auth helper accepts an optional email.send callback, including your own Resend sender. Initialization, existing verified-user sign-in, sessions and validation of an already issued token need no sender. Sign-up, resend verification and password-reset requests need one; its final reset also sends a password-change notification. Missing sender returns 503 AUTH_EMAIL_SENDER_NOT_CONFIGURED before those operations write. Email verification stays required; without a sender, unverified sign-in returns 403 EMAIL_NOT_VERIFIED and sends no email. The helper’s pg-pool constructor is not a Workers RPC adapter; use the actual database integration for your application. The optional Kysely dialect implements the leased transaction protocol. For application-owned Better Auth 1.7.7, use its own migrated schema, normally public: database: { db: db.withSchema("public"), type: "postgres", transaction: true } with that Kysely instance. This is separate from the managed auth-lane bridge; auth.provider: none provisions no auth tables. Library transaction behavior does not establish hosted signup or mail delivery; verify those application flows. Do not assume an unverified Drizzle or pg-proxy adapter supplies equivalent transactions.

App-owned password hashing

When the app hashes passwords in a Worker, verify a real registration and subsequent sign-in on the deployed environment. In ohmyho.st hosted tests, Workers WebCrypto PBKDF2-HMAC-SHA-256 rejected 250,000 and 260,000 iterations. Registration and sign-in succeeded with 100,000. These results describe compatibility on the tested Workers. Workerd checks a runtime-specific iteration limit. Cloudflare’s implementation Choose password-hashing parameters according to your security policy. Keep the algorithm version, salt and work factor with each stored hash and use those parameters to verify existing accounts. If your policy or existing hashes require a higher work factor than the deployed Worker supports, use a maintained authentication implementation on a compatible runtime.

Set up Google or GitHub sign-in

This example uses an application-owned Better Auth server handler with auth.provider: none. If you already use WorkOS or another provider, configure the social connection there and register the exact callback URL it supplies.
  1. Set Better Auth’s baseURL from the trusted URL for the chosen environment, such as https://dev.example.com or https://app.example.com. With the default /api/auth base path, the OAuth callbacks are /api/auth/callback/google and /api/auth/callback/github on that origin. If you use a different base path, register the callback for your deployed handler.
  2. For Google, configure the consent screen and audience in Google Auth Platform. Create an OAuth client of type Web application and add the full callback URL under Authorized redirect URIs, for example https://app.example.com/api/auth/callback/google. If your consent screen is in testing, add the users who will test sign-in. See Google OAuth setup and the Better Auth Google guide.
  3. For GitHub, go to Settings → Developer settings → OAuth Apps → New OAuth App. Set Homepage URL to the environment’s app URL and Authorization callback URL to its full callback, for example https://app.example.com/api/auth/callback/github. Register separate GitHub OAuth apps for Dev and Prod so each has its own callback and credentials. See GitHub OAuth app setup and the Better Auth GitHub guide.
  4. In the Better Auth server configuration, map each OAuth application’s client ID and secret to socialProviders.google or socialProviders.github. Store the client secrets separately in each environment using runtime secrets. A connected agent can prepare a secret_input_request link so you can enter them privately. Add the provider origins called by your server handler to runtime.egress.allow.
  5. Wire your buttons to authClient.signIn.social({ provider: "google" }) or authClient.signIn.social({ provider: "github" }). The OAuth redirect URI points to the server handler. Use the client call’s callbackURL option to choose the app page the user sees after sign-in. Test the full provider redirect, protected access, reload and logout in each environment.

Set up an environment

  1. Select Dev or Prod and read its actual URL.
  2. Configure exact callback/logout/allowed origins and an application-owned APP_URL for the same trusted environment origin. The runtime injects no general public URL; managed Better Auth alone receives its reserved base URL. Cross-origin form-post callbacks need the explicit browser origin/CORS policy, and Domain cookies are dropped.
  3. List server provider calls in runtime.egress.allow: at most thirteen exact HTTPS origins, no paths/ports/IPs; an omitted origin answers 403 Egress denied. Browser SDK calls use separate runtime.browser groups.
  4. Deliver private values with runtime secrets. Keep public identifiers separate from server credentials.
  5. Test login, callback, a protected page, reload and logout. Confirm protected access is denied after logout.
Use the hosted framework context for bindings and private configuration. A factory restricted to test mode or localhost cannot provide a production session. For Next.js, resolve getCloudflareContext({ async: true }).env; keep local test configuration separate. Route health and application session repositories through the same supported database adapter.

Bootstrap the first application user

An isolated Prod database receives schema migrations, not Dev users or tenant configuration. If the application needs a first administrator or tenant, run its existing, authorized bootstrap script or private administrative workflow with the auth library’s real password hashing and membership rules. Do not create a public bootstrap endpoint or enable test mode in production. Keep credentials out of source, logs and project notes. An authorized local bootstrap uses time-bound SQL access, such as ohmyhost database access create --project "$PROJECT_ID" --environment prod --mode write --ttl 1h --yes --json; revoke when finished. SQL access. A health response can succeed while no application user can sign in. Verify the first login and one protected business action on the final application origin before handing over access. The provider may send its own account-verification email; this does not automatically require managed ohmyho.st mail. The managed bridge uses the database and needs its configured platform sender only for email actions. An application-owned Better Auth handler can keep your chosen Resend callback or sender; only deliberately invoked ohmyho.st mail needs mail.enabled, Paid and your verified sender domain. A missing sender for a bridge email action returns HTTP 503 AUTH_EMAIL_SENDER_NOT_CONFIGURED before writes. When you select managed mail, its missing sender configuration returns mail_domain_required, and missing Paid access returns paid_plan_required. Report that dependency instead of turning off email verification or other security checks. Keep existing auth unless you explicitly decide to change it. Next.js · Vite · TanStack.