Get stable extension ID when testing unpacked extensions locally
Sometimes getting a random extension ID assigned when installing an unpacked extension is not good enough. You might be testing authentication flow in your extension and would prefer that your local extension ID matches the ID assigned by Chrome Web Store.
This can be achieved by using the key parameter in the manifest.json file. The key parameter is a unique hash of your extension that helps Chrome browser to consistently create the same extension ID as Chrome Web Store does.
You can figure out your extension key value by following these steps:
- Install your extension from Chrome Web Store (Create a private beta submission if it’s the first version of your extension)
- Navigate to folder
- MacOS: ~/Library/Application\ Support/Google/Chrome/Default/Extensions
- Windows: C:\Users{User}\AppData\Local\Google\Chrome\User Data\Default\Extensions\
- Find your extension folder
- Open manifest.json and copy the key value over to your unpackaged extension
- Install unpacked extension and observe that it gets the same ID as your Web Store extension
Note: Replace Default in the folder path with your profile name, if you are using Chrome profiles
Gotcha with Microsoft Edge browser and Edge add-ons store
Even though Edge browser is based on the same technology as Chrome browser and can run the same extensions without any modifications, there is a small gotcha when distributing your extension on both Chrome Web Store and Edge add-ons store. You will get a different extension ID assigned by each store and need to take that into account.