Skip to main content

Quick Start

1

Create an Application

import Anchorbrowser from 'anchorbrowser';

const anchorClient = new Anchorbrowser();

// Create an application for a target website
const app = await anchorClient.applications.create({
  name: 'My LinkedIn User',
  source: 'linkedin.com'
});

console.log(app.id);
2

Configure Auth Flow for the Application

Applications support multiple authentication flows: username_password, authenticator, and custom.
await anchorClient.applications.authFlows.create(app.id, {
  name: 'Email Login with authenticator',
  methods: ['username_password', 'authenticator']
});
3

Create Identity

Create an identity with credentials for the application.
const identity = await anchorClient.identities.create({
  source: 'https://linkedin.com',
  name: 'John Doe',
  credentials: [{
    type: 'username_password',
    username: 'john@example.com',
    password: 'secret'
  }]
});

console.log(identity.id);
For end-user self-service authentication, use the Embeddable Identity UI.
4

Create Authenticated Sessions

Use the identity ID to create an authenticated browser session.
import Anchorbrowser from 'anchorbrowser';

const anchorClient = new Anchorbrowser();
const identityId = "your-identity-id";
const session = await anchorClient.sessions.create({
    // Recommended settings for authenticated sessions.
    session: {
        proxy: {
            active: true,
        }
    },
    browser: {
        captcha_solver: {
            active: true,
        },
        extra_stealth: {
            active: true,
        }
    },

    // Identity to authenticate with.
    identities: [{ id: identityId }]
});

console.log(session.data.id);

Identity Metadata

You can add custom metadata to identities for filtering and organization. Metadata is a flexible key-value store that allows you to tag identities with custom attributes.

Creating an Identity with Metadata

const identity = await anchorClient.identities.create({
  source: 'https://linkedin.com',
  name: 'John Doe',
  metadata: {
    department: 'Engineering',
    role: 'admin'
  },
  credentials: [{
    type: 'username_password',
    username: 'john@example.com',
    password: 'secret'
  }]
});

Filtering Identities by Metadata

You can filter identities by metadata when listing them for an application:
const identities = await anchorClient.applications.listIdentities(app.id, {
  metadata: JSON.stringify({ department: 'Engineering' })
});