What is "content_capabilities" field in chrome extension's manifest file? - google-chrome-extension

I've searched Chrome Extension manifest document docs(https://developer.chrome.com/extensions/manifest), there's a "content_capabilities", but no link for that.
I infer it giving "permissions" to the "matches" as below.
"content_capabilities": {
"matches": [ "https://docs.google.com/*", "https://drive.google.com/*" ],
"permissions": [ "clipboardRead", "clipboardWrite", "unlimitedStorage" ]
},
but whenever I try to use this format in my local sample extension, I get this error.
'content_capabilities' is not allowed for specified extension ID
Is this format able to use in general users?

Indeed, it grants the specified permissions to web sites matching the
specified URL patterns. Here's why it was implemented:
Some hosted apps are used primarily to grant websites clipboardRead and clipboardWrite permissions, e.g. the Drive default hosted app. As part of the platform's move away from hosted apps, extensions should have the ability to grant these permissions to verified websites. These permission grants should be explicitly specified in the extension's manifest and displayed to users on extension install.
It's limited to a list of a few verified extensions (Google Drive and a few unnamed ones that could be internal Google extensions) but the restriction is applied only in the stable Chrome so you can use it in beta/dev/Canary channels [source].
In the old times (or even today in case you target the old browsers), if a web site like a text editor wanted to have the ability to access clipboard or an unlimited storage, the users had to install a separate hosted app for the site with the only purpose of granting these permissions. Hosted apps were deprecated long time ago (still supported though) so this content_capabilities key was exposed to extensions.
This is an obsolete thing now that the web platform supports the asynchronous Clipboard API and Persistent Storage API.

Related

Google drive API SCOPE : https://www.googleapis.com/auth/drive

I am making an multi-tenant platform that integrates client's Google drive to:
Create a folder in their Google Drive
Share Editor access with Tenants
Allow Tenants to create sub-folder and write documents.
I am using SCOPE: https://www.googleapis.com/auth/drive which works well.
However, the SCOPE is quite pervasive and Grant Full, permissive scope to access all of a user's files.
I just wanted access to create a folder editor access to things within.I don't want access to anything that client previously had in their Drive.
Do you think any way to have a limited SCOPE API?
Thanks to #Tanaike! SCOPE: https://www.googleapis.com/auth/drive.file is what solved my problem.
In that case, how about using the scope of
https://www.googleapis.com/auth/drive.file instead of
https://www.googleapis.com/auth/drive? The official document of
https://www.googleapis.com/auth/drive.file says Per-file access to
files created or opened by the app. File authorization is granted on a
per-user basis and is revoked when the user deauthorizes the app.. Is
this the direction you expect? – Tanaike 58 mins ago

"User Authentication" Chome App Tutorial Page

Trying to follow this intro to user authentication using OAuth 2.0 in a Chrome Extension I am developing. https://developer.chrome.com/apps/app_identity
But I can't follow it (missing information).
Add permissions and upload app
You need to make sure the identity permission is in your manifest. You can
then upload your app to the apps and extensions management page (see Publish).
This step is fine. I have uploaded my project and it is in the developer dashboard.
Copy key to your manifest
When you register your application in the Google OAuth console, you'll provide your application's ID, which will be checked during token requests. Therefore it's important to have a consistent application ID during development.
To keep your application ID constant, you need to copy the key in the installed manifest.json to your source manifest. It's not the most graceful task, but here's how it goes:
1.Go to your user data directory. Example on MacOs: ~/Library/Application\ Support/Google/Chrome/Default/Extensions
2.List the installed apps and extensions and match your app ID on the apps and extensions management page to the same ID here.
3.Go to the installed app directory (this will be a version within the app ID).
4.Open the installed manifest.json (pico is a quick way to open the file).
5.Copy the "key" in the installed manifest.json and paste it into your app's source manifest file.
Except, straight away, at step 1, I cannot progress. My app is not installed and therefore its ID does not appear in the user data directory.
Will installing the unpacked extension work? Well it doesn't appear in Default/Extensions directory so I guess not. Besides, it has been given a different ID than my dashboard instance.
Therefore, where do I get the key? There is a key associated with my app on the developer dashboard. But this "tutorial" doesn't mention that.
Is somebody able to explain what I should be doing such as pointing me to another resource to learn how to set up a basic user authentication for a Chrome App?
After uploading, from the developer dashboard you can click on the "More Info" on the right of your extension in the dashboard.
You will see several pieces of useful data:
item id - this is the extension id
public key - this is the "key" you want. Copy everything between (not including) the "BEGIN PUBLIC KEY" and "END PUBLIC KEY" markers, and paste it into a "key" property in your manifest.json
Here's one way to solve this:
In the Chrome Developer Dashboard, edit your current project.
Scroll down and click Preview Changes
Click the Share icon button next to Add To Chrome which is grayed out.
E-mail the link to yourself.
Follow the link to your app's store page and now you should be able to click Add To Chrome. It will then be installed on your system under [profile]/Extensions.

Share files with between group of user using Microsoft Live sdk

I am developing an application that requires to share files between users using Microsoft Live sdk. But only resource that I came across is by providing a shared link or embed link which expires after some time and are open to public usage. Instead, I want to share files among only certain group of one drive users and that too, permanently. This functionality is already present in one drive itself. Is there any way of doing it using one drive api ?
UPDATE: google drive api supports these.
The OneDrive API support the creation of sharing links, which would be easy to send to the group that you want to give access to a specific file or folder. These links do not expire, however they can be revoked.
Here is an example of the kind of request you can use to create one of these links
POST https://api.onedrive.com/v1.0/drive/items/{item-id}/action.createLink
Content-Type: application/json
{
"type": "view"
}

Installing a chrome extension in China

I'm designing a chrome extension for a global market. According to Google's page (https://developer.chrome.com/extensions/hosting):
As of Chrome 33, Windows stable/beta channel users can only download
extensions hosted in the Chrome Web store, except for installs via
enterprise policy or developer mode
I understand that network admins can still configure an "enterprise policy" - but what about non-enterprise users that don't have access to the chrome web store? - and yes, I'm thinking about users in China, where the CWS is blocked.
Any clever ideas (beside asking them to use VPN :/)?
TIA!
Users may ask their friends outside China to download the installation file of specific Chrome extensions, and send to them via email or other instant chat software (QQ or others).
Or when you distribute your extensions you can attach a download url for who can not access Chrome store directly. Extensions can be installed by local file without any access to Chrome store.

Allow another developer to manage a Chrome extension/app in the Chrome Web Store

I've done plenty of searching and I can't find ANY information about having multiple developers working on a Chrome extension.
Basically, I just want to grant another developer access to manage my Chrome extension in the Chrome Developers Dashboard. (ie so that it is listed in their Chrome developer Dashboard and they can publish it/change the logo etc).
EDIT 6 Aug 2013 - The Group Publishing feature allows organisations to create a group such that the extensions can be managed by multiple developers. For more info, see Group Publishing.
Old answer
An extension in the Chrome Web Store can be managed by only one Google account.
If you want to have multiple developers manage the extension, create a Google account for your company, pay 5$ to get the right to publish and share the credentials within the company.
If you want to transfer ownership of an extension to another account, fill in this form.
Assets (screenshots) are usually not updated very often. On the other hand, it's common to update the extension's source code and description, so letting the main developer manage the extension listing makes sense.

Resources