extcharge

Guide

User accounts in a browser extension without your own backend

1 December 2026

A browser extension can identify users without a backend of your own in three ways: an anonymous install ID stored in chrome.storage.local, Google sign-in through chrome.identity, or an email link sent by a hosted service. The install ID is private but lost on reinstall, Google sign-in works smoothly only in Chrome, and the email link works in every browser at the cost of one confirmation step.

This guide compares the three on what usually breaks: reinstalls, multiple devices, other browsers and privacy.

Do I need user accounts at all?

Often not. An extension that keeps settings on one device needs no identity. You need one as soon as something must follow the user: a purchase, a trial that must not restart, data on a second computer, or support requests you want to match to a person. Decide which of these you need before you pick a method, because each method solves a different subset.

How does an anonymous install ID work?

The extension creates a random ID on first use and stores it locally. It sends the ID with requests so a server, yours or a service's, can keep records per install.

// identity.js — works in the service worker, popup and options page
async function getInstallId() {
  const { installId } = await chrome.storage.local.get("installId");
  if (installId) return installId;
  const id = crypto.randomUUID();
  await chrome.storage.local.set({ installId: id });
  return id;
}

chrome.runtime.onInstalled.addListener(async ({ reason }) => {
  if (reason === "install") await getInstallId();
});

Creating the ID in onInstalled avoids two contexts generating different IDs at the same moment. getInstallId() still creates one if it is missing, for example after the user cleared the extension's data.

Trade-offs:

Do not put the ID in chrome.storage.sync to make it follow the user. Sync only works where the user has browser sync on, and it falls back to local storage otherwise, so the result is unpredictable.

Can I use Google sign-in with chrome.identity?

In Chrome, yes. chrome.identity.getAuthToken() returns an OAuth2 access token for the Google account in the browser, using the client ID and scopes in the oauth2 section of manifest.json. It needs the identity permission. The user may have to sign in to Chrome or approve the scopes.

// Requires "permissions": ["identity"] and an "oauth2" block in manifest.json.
async function signInWithGoogle() {
  const { token } = await chrome.identity.getAuthToken({ interactive: true });
  return token; // send it to a server that verifies it with Google
}

The limitation is portability. Microsoft Edge lists identity.getAuthToken as unsupported and points to launchWebAuthFlow instead. Firefox's identity API offers only launchWebAuthFlow and getRedirectURL. launchWebAuthFlow opens a provider's login page in a web view and returns the redirect URL, which means you configure an OAuth client yourself and handle the response.

Trade-offs:

How does an email link from a hosted service work?

The user types an email address on a hosted page. The service sends a link. The user clicks it, the service marks the address as confirmed, and the extension learns which confirmed email belongs to this install. There is no password to store or reset.

Trade-offs:

Which method should I pick?

  1. Settings only, one device: no account. Use chrome.storage.
  2. Usage records or anonymous analytics: install ID.
  3. Chrome-only, Google-centric audience, own server: chrome.identity.
  4. Purchases or trials that must survive reinstalls, any browser, no server of your own: email link through a hosted service.

The methods combine well. Start with an install ID for everyone, and attach a confirmed email only when the user pays or starts a trial. Then most users stay anonymous, and the ones with something to lose can recover it.

Do it with your AI assistant

Paste this into Claude Code, Cursor or a similar coding assistant inside your extension's repository:

Read https://extcharge.com/guides/user-accounts-chrome-extension.html and apply it to this extension.

Adding payments

ExtCharge uses the combined approach. Every install gets a random key on first use, and ExtCharge holds no personal data for it until the user pays or starts a trial. A trial starts when the user confirms the link sent to their inbox. On a new device or browser, extcharge.openLoginPage() asks for the email the user confirmed or paid with; after they confirm it, the purchase follows them. The one-prompt setup lets your AI assistant add it, and the integration guide covers every call.

Try ExtCharge on your extension

Connect your Stripe account, register your extension and add a plan. The dashboard walks you through it.