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:
- Reinstall:
chrome.storage.localis cleared when the extension is removed. A reinstall gets a new ID, and anything bound to the old one is unreachable. - Multi-device: each browser profile has its own ID. Nothing links them.
- Privacy: the best of the three. The ID says nothing about the person.
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:
- Reinstall and multi-device: good. The Google account is the identity.
- Other browsers: a separate code path, or no sign-in at all.
- Privacy: you learn the user's Google identity and ask for an OAuth consent. Some users of a small tool will not grant that.
- Still needs a server: a token proves nothing to the extension itself. Something outside the extension must verify it before it means anything.
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:
- Reinstall and multi-device: good. The user confirms the same address again on the new install and gets the same account.
- Other browsers: works the same everywhere, because it is a web page and an inbox.
- Privacy: you hold an email address. Name the service as a processor in your privacy policy.
- Friction: one switch to the inbox. Ask for it when it pays off for the user, for example when they buy or start a trial, not on first run.
Which method should I pick?
- Settings only, one device: no account. Use
chrome.storage. - Usage records or anonymous analytics: install ID.
- Chrome-only, Google-centric audience, own server:
chrome.identity. - 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.