Chrome extension id - how to find it - google-chrome

How can I find out what the chrome extension id is for an extension?

Use the chrome.runtime.id property from the chrome.runtime API.

You get an extension ID when you upload your extension to Google Web Store. Ie. Adblock has URL https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaibdccddilifddb and the last part of this URL is its extension ID cfhdojbkjhnklbpkdaibdccddilifddb.
If you wish to read installed extension IDs from your extension, check out the managment module. chrome.management.getAll allows to fetch information about all installed extensions.

If you just need to do it one-off, navigate to chrome://extensions. Enable Developer Mode at upper right. The ID will be shown in the box for each extension.
Or, if you're working on developing a userscript or extension, purposefully throw an error. Look in the javascript console, and the ID will be there, on the right side of the console, in the line describing the error.
Lastly, you can look in your chrome extensions directory; it stores extensions in directories named by the ID. This is the worst choice, as you'd have extension IDs, and have to read each manifest.json to figure out which ID was the right one. But if you just installed something, you can also just sort by creation date, and the newest extension directory will be the ID you want.

As Alex Gray points out in a comment above, "all of the corresponding IDs are actually on the extensions page within the browser".
However, you must click the Developer Mode checkbox at top of Extensions page to see them.

Extension IDs can be found in:
chrome://extensions (Chrome_Hotdog >> More_tools >> Extensions) Developer mode.
For Linux: $HOME/.config/google-chrome/Default/Preferences (json file) under ["extensions"].

All extension ID are listed here:
chrome://system

Related

Disable update of specific chrome extension

With recent news of adblock being sold to some unknown company, first thing i want to do is disable any possible update for that extension.
I've found number of questions but they are outdated. So chrome pros please tell how do we disable a specific plugin? and please take into consideration that there are many instances which synchronize it is important that the change gets synchronized to other computers, if it is not how do we do that?.
And a secondary question : where do we find sources of already installed extension? so that we could later pack and run it?
Chrome does not offer a way of disabling an update for a specific extension.
If you want to make sure that you run some specific version of an extension, you could try any of the following options:
Read-only extension folder
Go to the directory containing the extension, and mark the directory as read-only. To find that directory, visit chrome://version and look at the path at "Profile Path". The extension will then be at [value of Profile path]/Extensions/[32-character extension id].
Download the source code
Download the source code of the extension, and load it as an unpacked extension (or upload it to the Chrome Web store, and then install it).
There are several ways to get the source code (including just copying it from the directory as I mentioned at the previous step).
If you want to download a Chrome extension without installing it (e.g. because the new version contains unwanted "features" that you want to remove), then you could use my Chrome extension source viewer to download the code.
Some extensions expect to be run with a specific extension ID. You can forge this extension ID if you load the extension in unpacked mode (but you cannot upload the extension to the CWS if you do that). For instructions on fixing the extension ID, see How to change chrome packaged app id Or Why do we need key field in the manifest.json?.

Determining if an extension was installed through Chrome Web Store or not

I noticed that in chrome://extensions you can see a "Not from Chrome Web Store" message under extensions that were installed through, e.g. drag and drop into the extensions page. Screenshot of what I am talking about:
I was wondering if there is any way of getting that information from an extension API? I have played with the chrome.extensions.management API, but the only information that gives is the installType field, which is 'normal' for both Web Store and drag and drop installs. - https://developer.chrome.com/extensions/management#type-ExtensionInfo
Am I missing something, or will we just have to wait for an update to the management API?
Could you simply check if the updateUrl property is equal to https://clients2.google.com/service/update2/crx? I believe extensions in the Chrome Web Store must have that update URL, but I'm not sure about the other way around.
Either you install by drag-and-drop or you install form web store, both are called normal install type. Ultimately, you are trying to install the .CRX file, so it means it's a normal install type. Here is the help article. Search for "installType" and read description for "normal" in mentioned article.

How to make tag for chrome extension in webstore

I have done a extension for one specific website and uploaded it in my webstore developer account and published it.
After that if i try to search that extension in webstore it is not listing.
Any idea on this? Am i want to make any tag or something in my extension?
PS:
Here is an example of my scenario. I have created a extension for the website abcd.com and named the extension as "abcd - do action". When i search in webstore for abcd, its listing some of the extensions but not mine.
The Chrome Web Store index is updated on a delayed basis. Sometimes it can take a few hours or a few days before your item is searchable. You should also try searching without your own extension installed as sometimes the Chrome Web Store will hide installed extensions from results.

How to change chrome packaged app id Or Why do we need key field in the manifest.json?

I'm developing packaged app for chrome store using one-time chrome wallet payments. For my app I need to check during the runtime if user bought the app or not to decide should it be demo functionality or full functionality.
According to the chrome identity API documentation :
to keep application ID constant, You need to copy the key in the
installed manifest.json to your source manifest.
I have 2 questions about this procedure:
1) under what condition the id of my application may change? I've tried to re-install the app and made updates but the apps id remains the same.. If there is no way to change apps id than why do I need this procedure for?
2) how can I upload my zip archive with manifest.json (which contains "key" field) to chrome dashboard? The problem is that uploader throw an error at me:
An error occurred: Failed to process your item.
key field is not allowed in manifest.
Once uploaded to the Chrome Web Store, your extension ID is fixed and cannot be changed any more.
The ID is derived from the .pem file that was created the first time you (or the Chrome Web Store) packed the extension in a .crx file. When you load an extension in "unpacked mode", an ID is automatically generated in an unpredictable way. The only way to control the extension ID during development is by setting the "key" field in the manifest file, as the documentation suggests.
When you have already published the extension in the Chrome Web Store, then you can easily get the value of this "key" field using the Chrome Extension Source Viewer. After installing the extension, go to your Chrome web store details page and click on the CRX button to view the source. When the Chrome Extension Source viewer has loaded the extension, it will display the key in the console, which can directly be copy-pasted to your manifest.json:
If you have not published your extension, or you do not want to use the Chrome Web Store, then you need to generate a private key first.
Go to chrome://extensions/ and enable Developer mode.
Click on "Pack extension...", select your app/extension's directory and confirm.
Now you've got a .crx file and a .pem file. Back up the private key (.pem file)!
The extension mentioned can be used to get the same information. Alternatively, visit the online demo at https://robwu.nl/crxviewer/ and select the crx file you've just created (again: just open the console to see the "key" and extension ID).
When you're ready to submit your app/extension to the Chrome Web Store, follow the following steps:
Create a zip file containing your extension (important: manifest.json must be at the root, i.e. "directory/manifest.json" is bad, "manifest.json" is good).
Add the .pem file as key.pem!
(this is necessary to preserve the extension ID)
Upload the extension to the Chrome Web Store (without the "key" field in manifest.json, the CWS will reject any upload that contains a "key" field).
For subsequent updates, "key.pem" should not be added to the zip file, because the Chrome Web Store does not need it any more.
Hopefully somebody can give a better answer than me. An app's id is generated by google when you first upload it to the web store. However, it's not the same id that you have when developing locally. Your chrome browser generated some other id using some other mechanism.
When you are developing locally from your source code directory as an unpacked extension, and you want to use the id that the chrome web store assigned to your app, you put the "key" in your manifest and reload your app. This helps you because many APIs expect chrome.runtime.id (the id of your app) to be the same value as the app in the store. You can leave the "key" in your manifest and it will be ignored.
For anyone having problem loading the unpacked extension with the key field in the manifest.json file.
Remove your published extension if you have it in your extension list but disabled. Since otherwise your local dev extension won't load and no error will be shown. The reason being that chrome detects duplicate keys for the extension and ignores it silently.

How I can programatically get the chrome extension ID from a crx file?

I compile the extension using the --pack-extension switch:
C:\Users\APOL0\AppData\Local\Google\Chrome\Application>chrome.exe --pack-extension="D:\MyExt"
Everything works fine: chrome generates Myext.crx and Myext.pem but I don't know how I can get extension ID for automatic installation using Windows' registry.
How can I get this ID without using "manual verification", ie. programatically?
Edit May 14, 2018: Added clarification and link to 3rd party tool.
There is no official supported method (at time of writing) to programmatically get the extension ID from a CRX without manually interacting with Chrome. (See official method below)
Unofficial Method
The only programmatic method I've found any reference to online is on this SO answer. The author of the answer later posted a link to a ChromeIdGenerator tool they wrote to accomplish this. The tool is based on how Chrome calculated its extension IDs at that point. Full disclosure: I have not tested the tool to ensure its accuracy, it is simply the only tool I've found to accomplish what you're asking.
Official Method (manual)
If you open up your Chrome Extensions manager page, you can drag and drop your Myext.crx onto the page (you must be in "Developer Mode") and it will load your extension, showing you the new extension id.