Prerequisites
Before integrating the embedded identity flow, ensure the following are configured:- Create an Application - Define the target website users will authenticate to via the Anchor Dashboard or API
- Configure Authentication Flows - Set up the supported login methods.
Overview
1
Generate a Token
Create a one-time token that authorizes the identity creation flow.
2
Redirect User to Identity Creation
Redirect the user to the Anchor identity creation page with the generated token:The user will be guided through the authentication process for the target website configured in the application.
3
Handle the Callback
After the user successfully creates an identity, Anchor redirects them to the
callbackUrl with the identity ID:4
Update Identity Metadata (Optional)
Update the identity with additional metadata to maintain a mapping between users and their Anchor identities:
5
Create Authenticated Sessions
Once an identity ID is available, use it to create authenticated browser sessions:The browser session will automatically be authenticated to the target website using the stored identity.
Complete Integration Example
Here’s a complete example showing the full flow: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
- Authenticated Applications - Define target websites, authentication flows, and create pre-authenticated browser sessions
- Browser Profiles - Alternative approach using browser profiles

