Announcing the Google Drive Installation Scope

Wednesday, September 12, 2012 | 11:34 AM

Labels:

Not long after the Drive SDK was first released, we started receiving requests for a simpler developer and user experience. It took too long for developers to get started, and users were sometimes confused by the ways apps were installed. We’re now announcing a new feature that helps address these concerns: the Drive installation scope.

As the name suggests, this new OAuth 2.0 scope lets users install an app by approving an access request. Along with all the other levels of access you can request from users, it’s now possible to ask users for permission to install your app in their Drive.

This means that an app, or an app’s promotion page, could present an option to “Install this app in Google Drive,” and then users who select this option would interact with an OAuth 2.0 dialog that requests the installation scope. For example, the following script creates an “Add to Google Drive” button that could be embedded in a web page:

<script src="https://apis.google.com/js/client.js"></script>
<script>
var CLIENT_ID = '123456789.apps.googleusercontent.com'
function installDriveApp() {
  gapi.auth.authorize({
    client_id: CLIENT_ID,
    scope: 'https://www.googleapis.com/auth/drive.install',
    immediate: false
  }, function(authResult) { // Callback when installation complete });
}
</script>
<button onclick="installDriveApp();">Add to Google Drive</button>

On clicking this button, the user sees a standard OAuth 2.0 dialog box like the following (text for the installation scope is expanded in this example):

When the user approves these scopes, the app is installed for the user. Then, once it is installed this way, the app appears in the user’s Open with options as well as the Create > more contextual menu for files of registered MIME types.

Apps still need to specify primary and secondary MIME types when they enable the Drive SDK in the APIs console. But, unlike before, there is no need to install via the Chrome Web Store in order to get UI integration -- web store integration is entirely optional (though recommended).

Essentially, Drive now offers three levels of integration, which apps can combine according to their needs:

  • Simple API access with the Drive API enabled.
  • UI integration, with API access, the Drive SDK enabled, and OAuth-based installation.
  • CWS-based integration, with all of the above plus web store installation and marketing/upsell features.

For guidance in getting started integrating your app in any of these ways, see “Build a Drive Web App” or "Integrate with the Drive UI" in the SDK documentation.

We still recommend that developers consider the many benefits of creating a Chrome Web Store listing for their application. In addition to providing ease of installation for users “shopping” in the Drive app collection, a web store listing provides helpful features to market and promote an app. Our usage analysis shows that apps in the Chrome Web Store receive more usage than apps that aren’t listed. But now, with the installation scope, you can get started developing and testing your app more quickly and then list it in the Chrome Web Store when you’re ready.

If you have any questions about the installation scope, don’t hesitate to let us know on our Stack Overflow tag, google-drive-sdk.

Eric Gilmore

Eric is a technical writer working with the Developer Relations group. Previously dedicated to Google Apps APIs, he is now busy writing about all aspects of the Google Drive SDK.

3 comments:

Paul Bailey said...

Is there anyway to detect if the user has this installed? For example, I can detect whether they have the Chrome Web Store app installed and then hide the button. I'd like to do the same with this.

Mfawa Alfred Onen said...

I really love this...simple!

Eric G said...

Paul, if you know the appId value, you could use something like GET https://www.googleapis.com/drive/v2/apps/[appId] to test whether the app is installed for a user. You can also list a user's installed apps (if they authorize you to do so) using apps.list. Hope that helps!