Chrome Extensions have a unique CRX ID that rotates by default, which can cause errors with the Clerk integration. This guide demonstrates how to configure a consistent CRX ID so that your extension will have a stable, unchanging key. This guide assumes you are using the Plasmo framework. If you need help applying these concepts to another framework, contact support.
There are two ways to configure a consistent CRX ID:
Plasmo uses the package.json to generate a manifest.json on build, and allows for the use of environment variables in package.json.
In your package.json, in the manifest object:
Add "key": "$CRX_PUBLIC_KEY".
Set the permissions array to include "cookies" and "storage".
Set/update the host_permissions array to include "http://localhost/*" and "$CLERK_FRONTEND_API/*".
package.json
{// The rest of your package.json file"manifest": {"key":"$CRX_PUBLIC_KEY","permissions": ["cookies","storage"],"host_permissions": ["http://localhost/*","$CLERK_FRONTEND_API/*"] }}
Ensure that the development build is updated by running pnpm dev.
Open Chrome or a Chromium-based browser and navigate to chrome://extensions.
Remove and re-install the extension. To re-install, in the top-left, select Load unpacked. Navigate to where your project is located and select the build/chrome-mv3-dev folder. Then select Select. Your extension will now be loaded and shown in the list of extensions.
Plasmo uses the package.json to generate a manifest.json on build, and allows for the use of environment variables in package.json.
In your package.json, in the manifest object:
Add "key": "$CRX_PUBLIC_KEY".
Set the permissions array to include "cookies" and "storage".
Set/update the host_permissions array to include "http://localhost/*" and "$CLERK_FRONTEND_API/*".
package.json
{// The rest of your package.json file"manifest": {"key":"$CRX_PUBLIC_KEY","permissions": ["cookies","storage"],"host_permissions": ["http://localhost/*","$CLERK_FRONTEND_API/*"] }}
Verify that your extension has a consistent CRX ID by following these steps:
At the top-left of the Chrome Developer Dashboard, your extension ID will be displayed below the name of your extension.
In a separate tab, open Chrome or a Chromium-based browser and navigate to chrome://extensions.
Locate your extension in the list of extensions. Confirm that the ID shown in your extension matches the ID displayed in the Chrome Developer Dashboard.