How to Test Passkeys on Real Devices with Localtonet
Test a local WebAuthn app on real devices using a public HTTPS origin while keeping origins, relying-party IDs, and callbacks aligned.
In this article 12 sections
Validate WebAuthn ceremonies where users will actually perform them
A passkey flow can succeed on a developer workstation or with a CI virtual authenticator and still fail on a physical phone, tablet, or external authenticator. Real-device testing introduces public HTTPS origins, relying-party identifiers, redirects, cookies, and platform-specific prompts. This guide shows how to expose an existing working WebAuthn application with Localtonet, configure its public origin, and verify registration and later sign-in safely. Building or installing a WebAuthn implementation is outside this guide's scope. Our tunnel provides reachability; your application remains responsible for authentication and WebAuthn verification.
📋 What's in this guide
Why real-device passkey testing matters
WebAuthn coordinates browser JavaScript, server-generated challenges, relying-party configuration, authenticators, credential storage, and account state. A successful automated test confirms important parts of this ceremony, but not necessarily the experience on a user's physical device.
A virtual authenticator is a software implementation controlled by browser automation. It lets a suite create credentials, request assertions, and exercise failures without asking someone to touch a biometric sensor or insert a security key. Keep that repeatable coverage in CI. Physical-device testing complements it by checking actual browser prompts, credential providers, authenticator interaction, and public-origin configuration.
A phone may offer an integrated authenticator or an available synced passkey. An external authenticator may use USB, NFC, or another supported transport. A desktop flow that continues on a phone is yet another scenario. Support depends on the browser, operating system, authenticator, credential provider, and requested options. One successful prompt does not establish universal compatibility.
Understand the WebAuthn security boundary
A WebAuthn credential is registered for a relying party, not for arbitrary websites. The browser enforces origin and RP ID rules, while the server independently verifies the returned client data and authenticator response. A tunnel changes how a device reaches your application, not these security boundaries.
Secure contexts and localhost
WebAuthn is exposed in secure contexts. The W3C Secure Contexts specification describes potentially trustworthy origins, including HTTPS and special treatment for loopback development addresses. On a phone, however, http://localhost:3000 refers to the phone itself, not your development computer.
A plain HTTP URL using your computer's LAN address should not be assumed to receive localhost's treatment. A public HTTPS URL supplies a reachable secure origin without requiring a development certificate on the phone. Secure-context status is still only a prerequisite: RP ID checks, origin verification, cookies, and browser policy can independently prevent a ceremony.
Origin
An origin consists of scheme, hostname, and port, with default ports normalized by URL processing. Paths, query strings, and fragments are not included. As general WebAuthn education, https://login.example.com and https://login.example.com:8443 are different origins. Our HTTP tunnel's public HTTPS address has no port number; its local target port is not part of the browser's public origin.
The browser includes the ceremony origin in collected client data. The server must compare it with the exact origin, or intentionally configured set of origins, permitted for that environment. An application still configured to accept only localhost should reject a response initiated on its new public hostname.
Relying-party ID
The RP ID is a domain identifier, not a URL. It contains no scheme, path, query, fragment, or port. Under the ordinary rules in the Web Authentication specification, it is the origin's effective domain or a permitted registrable-domain suffix. A public suffix is not an acceptable way to broaden credential scope.
WebAuthn Level 3 also defines related-origin requests, which can support relationships outside that ordinary suffix rule under explicit validation and browser-support requirements. That exception does not authorize arbitrary unrelated domains and is unnecessary for this isolated test. Use the exact assigned hostname. Never select a shared tunnel-provider parent domain merely because a browser might accept it.
If omitted, the browser derives the RP ID from the origin's effective domain under WebAuthn processing rules. If supplied, it validates the relationship. Authenticator data contains an RP ID hash that the server must verify. That check does not replace exact origin verification: origin identifies the initiating web context, while RP ID defines credential scope.
Localtonet does not automatically choose your application's RP ID, update its origin allowlist, or register identity-provider callbacks. Never disable challenge, origin, RP ID hash, signature, or user-verification checks to make a test pass.
Prerequisites for a controlled test
Start with an existing application whose registration and authentication flows already work locally. You need its supported startup procedure, access to its configuration, and an isolated test database or account space. This tutorial does not supply a WebAuthn server, dependency installation commands, or a replacement for your library's verification procedures.
- Configuration access: locate accepted WebAuthn origins, RP ID, public base URL, trusted hosts, cookies, and identity-provider callbacks where applicable.
- Localtonet access: use a Localtonet account and a connected client on a device that can reach the local service.
- Physical test device: choose a browser and authenticator representative of an environment your application supports.
- Synthetic data: prepare disposable accounts without production credentials, personal information, or administrative privileges.
- URL prerequisites: Custom subdomain requires account balance. Custom domain requires balance and a domain already added in DNS Manager.
Install, launch, and authenticate the client before creating the tunnel
Open our HTTP tunnel documentation and follow its Quick start link under “Before you start.” Use that official path to install the client for your operating system on the device that can reach your application, launch it, and authenticate it with that device's token. Keep the client running. Before proceeding, verify that the authenticated device is connected and that you can identify the same token when selecting Device token in the tunnel form.
The supplied HTTP documentation confirms this prerequisite but does not include the Quick start's operating-system-specific installation, launch, token-entry, or connection-status instructions. Those details could not be independently verified here, so this guide intentionally does not invent shell commands, installer steps, or client UI labels. Complete those actions using the current Quick start before beginning the five-step HTTP workflow below.
An HTTP tunnel keeps its subdomain until you delete the tunnel. Stopping and starting it does not change the subdomain. You do not need a custom hostname solely to preserve credentials across ordinary restarts. New or replacement tunnel configurations are the hostname-change risk to plan for.
Prepare and verify the local application
Start the application through its project's supported procedure before creating the tunnel. From the device running the Localtonet client, open the exact local address and port. Confirm that the expected application appears, required APIs respond, and the database and session store are available. A framework placeholder page is not a successful application check.
Exercise account creation, enrollment, sign-in, logout, and recovery where implemented. If registration fails locally, fix it before adding a public endpoint. Record the actual listening address and port instead of assuming a framework default.
For a service on the client device, 127.0.0.1 can be an appropriate target. If either component runs inside a container, virtual machine, or subsystem, remember that loopback is relative to that environment. Verify reachability from the client, not merely from another browser on the host.
| Setting | What to establish before testing |
|---|---|
| Local IP address and port | The exact service reachable from the Localtonet client device. |
| WebAuthn origin and RP ID | Where your application configures both values and whether changes require a restart. |
| Public base URL and trusted hosts | How generated links and redirects will remain on the assigned public host. |
| Identity-provider callbacks | Permission to register the exact temporary callback, if an identity provider participates. |
| Cookies and challenge storage | Session continuity, expiration, and one-time challenge consumption across the complete ceremony. |
Configure the Localtonet HTTP tunnel
With Localtonet, the client connects outbound to our relay infrastructure. You do not need inbound router port forwarding, firewall changes, VPN setup, or a public IP address. Localtonet provides the public HTTPS certificate, so your local web service can remain on plain HTTP. This is a statement about public HTTPS and the supported local target, not a claim of end-to-end TLS extending to a plain HTTP application.
Once the client is installed, authenticated, and connected, follow the five steps in our HTTP tunnel documentation:
Open the HTTP page
Open My Tunnels > HTTP and select Create HTTP Tunnel to open the form.
Choose the URL type
Choose Random subdomain for a generated name, Custom subdomain for a name you enter, or Custom domain for your own domain. Custom subdomain requires balance; Custom domain requires balance and a domain added in DNS Manager. Follow the current custom-domain instructions linked from the HTTP documentation for DNS configuration.
Choose the device and region
In Device token, select the token used by the connected client. In Server region, select an available region close to the device. Use the current choices, not a server code copied from another environment.
Enter the local address and create the tunnel
Select Domain; for Custom domain, the list contains only your own domains. Fill Subdomain only for Custom subdomain, using letters, digits, and hyphens. Enter the verified Local IP address and Local port. The address accepts IPv4, IPv6, or localhost; the port range is 1 to 65535. Select Create tunnel. The configuration appears under Your tunnels as Tunnel # followed by its ID.
Start the tunnel and open its URL
Select the start button in Actions. When the tunnel runs, its address in URL becomes a link. Open it and record the assigned HTTPS address. If the selected client is offline, the dashboard displays a dialog; start the client, or use the documented Start anyway option to make the tunnel go live when that client connects.
Creating the configuration is not the same as running it. The public endpoint forwards only while the selected device is connected and the tunnel is running. The public HTTPS address contains no port number, regardless of the local port you entered.
Testers need the public application URL, not your Localtonet device token. Do not put the token in browser-side code, repositories, screenshots, fixtures, or issue reports.
Align the application with the public endpoint
Copy the public address from the running tunnel rather than reconstructing it from memory. Configure the application through its supported settings. The following worksheet uses reserved example domains, not actual Localtonet endpoints or addresses to visit. Replace them with your assigned hostname.
| Worksheet item | Illustrative value | Interpretation |
|---|---|---|
| Full page URL | https://passkey-lab.example.com/account/passkeys?mode=test#enroll | The page a tester opens; path, query, and fragment are not origin components. |
| Exact allowed WebAuthn origin | https://passkey-lab.example.com | Compare against the origin in collected client data. |
| Exact-host RP ID | passkey-lab.example.com | The recommended scope for this isolated test. |
| Invalid RP ID syntax | https://passkey-lab.example.com, passkey-lab.example.com:443, passkey-lab.example.com/account | RP IDs cannot contain a scheme, port, or path. |
| Invalid under the ordinary domain rule | unrelated.example.org | Not the page hostname or a permitted suffix. Related-origin requests are outside this test's scope. |
| Invalid public suffix | com | A public suffix is not an acceptable RP ID. |
| Illustrative identity callback | https://passkey-lab.example.com/auth/callback | Use your application's actual route; identity callback matching includes the path. |
Keep WebAuthn origin checks separate from CORS
Your backend's WebAuthn verifier checks the origin contained in clientDataJSON. CORS controls browser access to cross-origin HTTP responses. Updating an API's CORS allowlist does not configure WebAuthn origin verification, and passing a WebAuthn origin check does not solve a failed cross-origin API request. Configure each deliberately if your frontend and API use different origins.
Use an exact allowed origin, not a wildcard. Use the exact assigned hostname as RP ID for this tutorial, never a provider-owned parent domain. The local address, such as 127.0.0.1:3000, belongs in the tunnel target configuration, not the public RP ID.
Update redirects, callbacks, and cookies
Set the application's public base URL so links and redirects stay on the intended hostname. Register the exact callback at any participating identity provider. Review session cookies for domain, Secure, and SameSite behavior appropriate to your flow. A page can load successfully while a cookie scoped to localhost breaks challenge continuity.
If the framework relies on forwarded request information, use its recommended trusted-proxy configuration. Do not blindly trust forwarded headers from every source. Restart or reload the application if its configuration model requires it, then reopen the public URL in a fresh session and check every redirect.
Verify reachability, capability, and complete ceremonies
Check connectivity before passkeys
First reopen the configured local target from the client device. Then open the public HTTPS URL on the development device and finally on the physical test device. Confirm the same application appears, HTTPS is accepted, APIs respond, and navigation does not return to localhost or an obsolete hostname. Start with a top-level page rather than an iframe to reduce browser-policy variables.
Run a small browser capability check
Run this in the console of the actual public test page where developer tools are available. It performs feature detection only; it does not register a credential or prove that a particular account has a passkey.
(async () => {
const PKC = window.PublicKeyCredential;
const result = {
origin: window.location.origin,
secureContext: window.isSecureContext,
webAuthn:
typeof PKC === "function" &&
typeof navigator.credentials?.create === "function" &&
typeof navigator.credentials?.get === "function",
platformUserVerification: "not exposed"
};
if (typeof PKC?.isUserVerifyingPlatformAuthenticatorAvailable === "function") {
try {
result.platformUserVerification =
await PKC.isUserVerifyingPlatformAuthenticatorAvailable();
} catch (error) {
result.platformUserVerification = `check failed: ${error.name}`;
}
}
console.table(result);
return result;
})();
Expected results are your exact public origin, secureContext: true, and webAuthn: true. For a supported, available user-verifying platform authenticator, the last field is true. A false result does not rule out an external authenticator or another supported flow; “not exposed” means that capability probe is unavailable. Browser and platform support must still be tested on your supported versions.
Choose a discoverable-passkey lane
Not every WebAuthn credential is a discoverable passkey. A non-discoverable credential can authenticate successfully when the server supplies its credential ID, without supporting username-less credential discovery. To prove the passkey lane rather than generic WebAuthn, make your intended options explicit:
residentKey: registration withauthenticatorSelection.residentKey: "required"requires a discoverable credential."preferred"can permit a fallback, so success alone does not prove discoverability.userVerification: use"required"for a lane requiring authenticator user verification, both during registration and authentication. The server must enforce the corresponding verified flag. “Preferred” is not a guarantee of verification.allowCredentials: an omitted or empty list during authentication enables discoverable credential selection. A populated list restricts eligible credential IDs and is useful for a separate username-first lane.
Apply these options through your existing library. They are test-lane requirements, not a complete options object or a reason to weaken your application's policy. An authenticator unable to meet required options should fail that lane rather than silently count as a pass.
Same-device registration acceptance criteria
On the physical device, sign in to a synthetic account and start enrollment at the public URL. Confirm the actual request uses the intended RP ID, discoverability requirement, and verification requirement. Approve the prompt using the selected authenticator.
- The server validates the issued challenge, registration type, exact origin, RP ID hash, required flags, supported algorithm, credential uniqueness, and applicable attestation policy.
- The challenge belongs to that enrollment session and account, has not expired, and is consumed once.
- A verified credential ID and public key are associated with the intended synthetic account through the normal registration path.
- The UI reports completion only after server acceptance. Cancellation produces no successful enrollment or partial account mutation.
Later sign-in acceptance criteria
Sign out, close and reopen the application, and return to the same public hostname on the same physical device. For the username-less lane, begin authentication without entering an account identifier and without a populated allowCredentials list. Confirm that selecting the newly enrolled passkey signs in to the expected synthetic account, rather than merely restoring an old authenticated session.
A username-less challenge must be bound to the ceremony and session, with expiration and one-time use, but need not be bound to a known user before account discovery. On return, resolve and validate the account using the credential ID and user handle. Check their relationship against stored registration data, then verify the assertion with the stored public key. Do not trust an arbitrary returned handle as proof of identity.
For username-first authentication, also verify that the returned credential belongs to the requested account. In both lanes, validate challenge, authentication type, exact origin, RP ID hash, signature, required authenticator flags, and the library's applicable counter policy. Create the authenticated session only after all checks pass.
Negative cases
Cancel a prompt and confirm that no session is created. Let a challenge expire, then confirm rejection. In an authorized isolated test, replay a completed response and confirm it is rejected. Exercise an account with no applicable credential and a deliberately mismatched origin or RP ID configuration, restoring the correct configuration afterward. Preserve strict validation throughout.
Run a focused real-device test matrix
Begin with one device and one account, then expand according to your supported user population. Record device model, OS and browser versions, authenticator or credential provider, RP ID, origin, option values, and outcome. Check current primary browser and platform documentation before claiming support for a particular cross-device, embedding, or credential-provider feature; this guide does not establish a version-specific compatibility matrix.
| Lane | What to exercise | Acceptance boundary |
|---|---|---|
| Same-device discoverable passkey | Require a resident credential and perform later authentication without credential IDs. | The returned credential and user handle resolve to the correct account after verification. |
| Username-first WebAuthn | Select an account and supply its eligible credential IDs. | The assertion belongs to that account; success alone does not demonstrate discoverability. |
| External authenticator | Use the intended physical key and supported transport. | The actual key satisfies requested resident-key and verification requirements. |
| Cross-device authentication | Test the supported continuation flow between physical devices. | Record prerequisites and actual behavior separately from same-device success. |
| CI virtual authenticator | Repeat ceremony and negative-path regression tests. | Automated coverage supplements, rather than proves, physical-device compatibility. |
For each applicable lane, record registration, authentication, cancellation, return visit, missing credential, and logout. Test recovery and credential removal separately if your application supports them. Do not infer syncing or cross-device availability merely because a discoverable credential was created.
Protect the temporary test environment
A public URL changes the exposure boundary of a development service. Expose only the intended application, not an unrestricted development host with administrative tools, debugging consoles, unrelated services, or sensitive records. Apply application authentication, least privilege, and restricted enrollment. Use IP restrictions or other access controls where your deployment supports them.
Keep anti-CSRF controls, rate limits, session protections, and WebAuthn verification active. A hard-to-guess hostname is not authorization. Our tunnel is a connectivity mechanism, not permission to bypass organizational security or network policies.
Never test with production credentials or expose Localtonet tokens. Record validation outcomes and sanitized configuration rather than session cookies, authorization headers, or reusable secrets. Stop the tunnel when testing is complete.
Operate the tunnel and handle endpoint changes
The selected client must remain connected and the tunnel must remain running. A stopped tunnel, sleeping client device, exited client, or lost connection interrupts reachability. These conditions are distinct from a WebAuthn rejection.
Keep a session record
Record the tunnel hostname, local target, application configuration version, synthetic account, device details, browser, test lane, and start time. Do not record device tokens or private credential material. This makes it possible to distinguish a code regression from changed options, an expired challenge, or an unavailable authenticator.
Preserve the configuration for repeat tests
An HTTP tunnel retains its subdomain until deletion. Routine stopping and starting does not change it, so a return-visit test can reuse the same origin and RP ID. Keep the tunnel configuration if you need that identity for another session, but stop it between sessions when exposure is unnecessary.
If you delete and replace the tunnel, create another configuration, or otherwise change the public hostname, revisit the origin allowlist, RP ID, base URL, callbacks, trusted hosts, cookie scope, and CORS configuration where relevant. Credentials scoped to an old exact-host RP ID should not be assumed to work on a different hostname. Register a new synthetic credential rather than widening scope or disabling verification.
Clean up deliberately
Stop the tunnel after testing. Delete disposable configurations when hostname continuity is no longer needed. Remove obsolete callbacks, stale allowed origins, synthetic accounts, and test credentials according to your retention policy. Shutdown and cleanup are operational actions, not extra steps in the documented creation sequence.
Troubleshoot passkey failures by symptom
Work from the network upward. Identify the first failing checkpoint, change one relevant setting, and repeat the smallest confirming test. Do not change WebAuthn security settings to fix an unreachable local service.
| Symptom | Actionable checks |
|---|---|
| Local target fails | Check the running process, bind address, port, dependencies, and reachability from the client device. Recheck container or virtual-machine loopback assumptions. |
| Local target works; public URL fails | Confirm the correct Device token, connected client, started tunnel, target address, and current URL. |
| Wrong application appears | Compare Local IP address and Local port with the service you actually verified. |
| Navigation returns to localhost | Inspect base URLs, generated absolute links, redirects, callback destinations, and framework proxy configuration. |
| WebAuthn API is unavailable | Run the capability check on the ceremony page. Check HTTPS, certificate acceptance, actual browser support, and whether the page is embedded. |
| Browser rejects the RP ID | Use the exact assigned hostname without scheme, port, or path. This test does not rely on related-origin exceptions. |
| Prompt succeeds; server rejects registration | Inspect challenge state, client data type, exact origin, RP ID hash, required flags, algorithm, attestation policy, and credential uniqueness. |
| API request fails before verification | Check request routing and CORS separately from the WebAuthn verifier's origin allowlist. |
| Ceremony loses state | Inspect cookie domain, Secure and SameSite behavior, session storage, expiration, and one-time challenge handling. |
| Username-first works; username-less fails | Check discoverable registration, empty or omitted allowCredentials, credential availability, and server credential/user-handle resolution. |
| No suitable authenticator | Check the selected authenticator, requested attachment, residentKey, and userVerification requirements. Do not count unsupported fallback behavior as a pass. |
| Old credential fails after a hostname change | Compare old and new RP IDs. A routine tunnel restart does not change the subdomain; investigate replacement configurations or application settings. |
| Top-level works; iframe fails | Review secure-context ancestry, WebAuthn embedding rules, Permissions Policy, and the tested browser's support. Keep the baseline test top-level. |
| Replayed response is accepted | Fix server challenge consumption. Bind challenges to ceremony/session and, when already known, the intended user. Resolve and validate the account after discovery for username-less authentication. |
When server verification fails, preserve the rejection until you understand it. Compare sanitized configuration with stored ceremony state rather than replacing precise checks with wildcard acceptance. When a passkey appears missing, also check browser profile, OS account, credential provider, and external key availability before assuming the credential was deleted.
Frequently asked questions
Why does a passkey work on localhost but fail on my phone?
The phone's localhost refers to the phone. A public test also introduces a different origin and can expose RP ID, callback, cookie, or browser differences. Our HTTPS tunnel provides reachability, but your application must accept the exact public origin and use a valid RP ID.
Does my local application need its own HTTPS certificate?
Localtonet provides the certificate for the public HTTPS address. The local web service can remain on plain HTTP. Do not interpret that as end-to-end TLS reaching the plain HTTP service.
Will stopping and starting the tunnel change my passkey hostname?
No. An HTTP tunnel keeps its subdomain until deletion. Stopping and starting does not change it. New or replacement configurations may introduce a different hostname and require new origin settings and synthetic credentials.
Does Localtonet configure my RP ID or allowed origins?
No. Configure those in your application. For this isolated test, use the exact assigned hostname as RP ID and its HTTPS origin as the allowed WebAuthn origin. Never use a provider-owned parent domain merely to broaden credential scope.
Does successful WebAuthn authentication prove username-less passkeys work?
No. A non-discoverable credential can work with a server-supplied credential ID. Test discoverable registration and later authentication without a populated allowCredentials list, then verify correct account resolution from the returned credential and user handle.
Can real-device tests replace virtual authenticators in CI?
No. Virtual authenticators provide repeatable regression coverage. Physical devices validate actual platform interaction, credential availability, and public-origin behavior. Use both and avoid generalizing compatibility from one device.
Does creating the tunnel make it immediately available?
No. Start it from Actions, and keep the selected client connected. The endpoint forwards only while both conditions hold. Stop it after testing and remove disposable accounts, callbacks, and configurations when no longer needed.
Test your local passkey flow on a real device
Verify your existing WebAuthn application locally, connect our client, and create an HTTP tunnel. Align the exact public origin and RP ID, then test registration, later sign-in, cancellation, and cleanup with synthetic accounts.
Get Started Free →Corrections & updates
Substantive changes approved by the Localtonet editorial team are listed transparently below.
Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.