When using Anon Link for web, your users will be prompted to install an extension which must run Anon’s Chrome Extension Library.

You can configure this extension using the chromeExtensionId parameter when creating a link url. By default, this parameter is set to use Anon’s chrome extension ID: lbgbplnejdpahnfmnphghjlbedpjjbgd.

Chrome Extension Options

You have three options:

  1. Use Anon’s official Chrome extension

  2. Build your own custom extension

    • Use our extension example
    • Customize with your own branding
    • Includes pre-configured Anon Chrome Extension Library
  3. Integrate with your existing extension

    • Install the Anon Chrome Extension Library into your current Chrome extension

Add to Your Existing Chrome Extension

This guide assumes you have an existing chrome extension project.

If you are starting from scratch, get started with our Chrome extension example, and skip to Step: Install the Chrome Extension!

1

Create a .npmrc File

.npmrc
@anon:registry=https://npm.cloudsmith.io/anon/anon-sdk/
//npm.cloudsmith.io/anon/anon-sdk/:_authToken=YQtlU86MhKOXijPS
@npm:registry=https://registry.npmjs.org/

.npmrc files are supported by both yarn and npm for installing packages from other package registries.

And yes, this is a public authToken :)

2

Install the Anon Chrome Extension Library

npm
npm install '@anon/sdk-browser-extension'
3

Configure the extension manifest

Add the following permissions to your extension’s manifest.

"manifest": {
  "host_permissions": [
    "<all_urls>"
  ],
  "permissions": [
    "activeTab",
    "cookies",
    "notifications",
    "scripting"
  ],
  "externally_connectable": {
    "matches": ["*://*.anon.com/*"]
  }
}

For reference, see our example extension manifest here.

4

Initialize the library

Add this code snippet at the top of your background script:

import { anon } from "@anon/sdk-browser-extension"

anon({ environment: "sandbox" })
5

Install the Chrome Extension

  1. Run npm build
  2. Go to “Manage extensions” in your Chrome-based browser (Google Chrome, Arc, Brave, etc)
  3. Enable developer mode (toggle in top right)
  4. Click on “Load unpacked extension”
  5. Navigate to the build directory of your Chrome extension project
  6. Select the folder containing the extension’s compiled source and assets (e.g. chrome-mv3-dev or chrome-mv3-prod)
6

Create a Link URL

Get the chromeExtensionId of your extension from the “Manage Extensions” page (e.g. “chrome://extensions/”).

Developer Mode must be enabled to see the ID.

Example chrome extension ID.

Create a link url and set YOUR_CHROME_EXTENSION_ID to the ID of your extension in the Manage Extensions page.

curl -G \
  --url 'https://svc.sandbox.anon.com/link/url' \
  --data-urlencode 'app=INTEGRATION_NAME (e.g. facebook)' \
  --data-urlencode 'appUserId=YOUR_APP_USER_ID (e.g. user-123)' \
  --data-urlencode 'redirectUrl=YOUR_REDIRECT_URL (e.g. https://myapp.com/connectionSuccess)' \
  --data-urlencode 'chromeExtensionId=YOUR_CHROME_EXTENSION_ID (e.g. ahfopcpkajaiggfoacgieeejdcjadnee)' \
  --header 'Authorization: Bearer YOUR_ANON_API_KEY (e.g. anon_randomLettersAndNumbers)'

Open the link url in your browser, and see that Anon Link recognizes that your custom extension has alreadybeen installed. Continue as normal to link the user’s account.

You’ve successfully used your own custom extension to link an account!

To release your extension to the public, and create link urls for real users, you must submit it to the Chrome Web Store.

Submit to the Chrome Web Store for Approval

Follow the Chrome Web Store guide for publishing your chrome extension. If you used the example extension template which uses the Plasmo browser extension framework, you can follow their guide for automated publishing as well.

Once your extension is approved, you must set the chromeExtensionId parameter when creating your link urls to align with your new public extension ID.

For example, Anon’s public chrome extension ID is lbgbplnejdpahnfmnphghjlbedpjjbgd. This can be found in the URL of the Chrome Web Store listing URL for your extension:

https://chromewebstore.google.com/detail/anon-link/lbgbplnejdpahnfmnphghjlbedpjjbgd

Permission Justification

To submit your extension to the Chrome Web Store, you must justify the permissions you are requesting.

Remove any permission that is unused in your extension, then give a short justification for each used permission. For example, the following justifications were used for the permissions required by the Anon Link Chrome Extension Library:

activeTab

“The extension uses the screen contents of the active tab to determine whether the user has finished logging in to their account.”

notifications

“The extension allows the user to optionally enable receiving push notifications for when an app they’re using needs to reconnect to a session they’ve previously shared.”

scripting

“The extension uses the scripting permission to run content scripts that save a user’s session for an online account. The user can then share access to that session with another app they use.”

cookies

“The extension uses the cookies permission to access cookies that are part of a user’s session with an account they would like to connect to another application.”

host permission

“The extension allows the user to share access to their online account for any host.”