Prerequisites
Before integrating OmniConnect, ensure the following are configured:- Create an Application — Define the target website users will authenticate to via the Anchor Dashboard or API.
- Authentication flows — You do not need to manually add an auth flow just to use OmniConnect. New applications include a default Standard authentication flow: the end user signs in through a guided browser experience while Anchor detects the site’s login steps and persists the resulting identity. Add or edit flows in the dashboard or API only when you need fixed credential forms (for example username/password templates), extra methods (authenticator, custom fields), or multiple named login paths.
Overview
Redirect User to Identity Creation
Redirect the user to the Anchor identity creation page with the generated token:After the user finishes, Anchor shows a success step. When they continue (or close), the browser is sent to your
callbackUrl with the new identity.Handle the Callback
Anchor redirects to your Read If you open the identity flow in a popup (
callbackUrl using snake_case query parameters:identity_id on your server. status is success when the identity was created.window.open) instead of a full redirect, the Anchor page may notify the opener with postMessage (type: 'identity-created', identityId). Validate event.origin before trusting the message; the HTTPS callback remains the most reliable way to persist the mapping server-side.Update Identity Metadata (Optional)
Update the identity with additional metadata to maintain a mapping between users and their Anchor identities:
See it in action
Try OmniConnect on the live demo: demo.anchorbrowser.io — connect an account from the chat UI, then run automations. The full app is open source: github.com/anchorbrowser/chat-demo (Next.js, Anchorbrowser Node SDK, WorkOS AuthKit). Clone it and follow the README forANCHORBROWSER_API_KEY, and callback base URL.
The demo matches the integration described above:
applications.createIdentityToken(applicationId, { callbackUrl })- seesrc/lib/anchorbrowser.ts.- Redirect URL -
getIdentityCreationUrlbuildshttps://app.anchorbrowser.io/identity/create?token=…(override withANCHORBROWSER_APP_URLwhen needed). - Callback - Identity callback route (
src/app/api/identity-callback/[conversationId]/route.ts) readsidentity_idfrom the query string (with a fallback for legacyidentityId), then tags the identity and creates a session. - Sessions -
sessions.createpassesidentitiesat the top level next tobrowserandsession; the SDK wraps the session payload inresponse.data(the demo returnsresponse.dataand usesid/live_view_urlfrom that object - same data assession.datain the snippets earlier on this page). - Popup option -
src/components/identity-popup.tsxlistens forpostMessagewithtype: 'identity-created'; the HTTPS callback remains the source of truth for persistence.
src/lib/tools.ts.
Best Practices
Secure Token Handling
Generate tokens server-side and never expose your API key to the frontend. Tokens are single-use and should be used immediately.
Store Identity Mappings
Maintain a mapping between your users and their Anchor identity IDs in your database for future session creation.
Use Metadata
Store your external user ID in the identity metadata to easily correlate identities with your users.
Handle Errors
Implement proper error handling for cases where identity creation fails or the user cancels the flow.
Related Resources
- Chat demo (live) and chat-demo source - reference implementation for this guide
- Authenticated Applications - Define target websites, authentication flows, and create pre-authenticated browser sessions

