Configure OAuth for your application

To configure OAuth for your application, you set up an OAuth workflow, and you enable the Data Portability API OAuth scopes.

Set up an OAuth workflow

To set up an OAuth flow for your application, follow the basic steps in the Google Identity documentation.

Most developers use the Server-side Web Apps flow for obtaining OAuth consent, but you can also use the JavaScript Web Apps flow or the Mobile and Desktop Apps flow.

Data Portability API OAuth scopes

When you configure your Data Portability API application for OAuth, enable the Data Portability API OAuth scopes that are relevant to your application. Some scopes are sensitive and restricted and are subject to additional requirements.

When you add the Data Portability API scopes to your OAuth flow, there may be cases where your user gives consent to some but not all of the scopes. Your app must be able to handle these cases by:

  • Allowing partial data exports
  • Notifying the user that they didn't select all the necessary scopes (and failing gracefully)
  • Asking the user for the remaining consents

You should note that a user's consent allows you one data export for that specific consent. To download the data again, you need a new consent from the user.

You should also note that during the OAuth flow, your app does not know which Google Account was used to give consent. The OAuth token your application receives is opaque.

If you are looking for information on how users share data, see Share a copy of your data with a third party.

Scopes restrictions

This section covers restrictions in scopes that result in errors.

Mixed scopes

Requests for Data Portability API scopes (such as, https://www.googleapis.com/auth/dataportability.*) can't be mixed with other scopes (such as, https://www.googleapis.com/auth/userinfo.email). Here is an example of a bad request, with the restricted part bolded:

https://accounts.google.com/o/oauth2/v2/auth?
client_id=client_id&
redirect_uri=redirect_uri&
response_type=token&
scope=https://www.googleapis.com/auth/dataportability.myactivity.search+https://www.googleapis.com/auth/userinfo.email&
include_granted_scopes=false

Previously granted scopes

You should never set include_granted_scopes=true when requesting DPAPI scopes. Here is an example of a bad request, with the restricted part bolded:

https://accounts.google.com/o/oauth2/v2/auth?
client_id=client_id&
redirect_uri=redirect_uri&
response_type=token&
scope=https://www.googleapis.com/auth/dataportability.myactivity.search&
include_granted_scopes=true

Scopes categories

This table contains all OAuth scopes supported by the Data Portability API and their categories. For a list of all resource groups and OAuth scopes supported by a particular service, see the schema reference page for that service.

ScopesDescriptionCategory
https://www.googleapis.com/auth/dataportability.alerts.subscriptionsMove a copy of the Google Alerts subscriptions you created.Sensitive
https://www.googleapis.com/auth/dataportability.businessmessaging.conversationsMove a copy of messages between you and the businesses you have conversations with across Google services.Restricted
https://www.googleapis.com/auth/dataportability.chrome.autofillMove a copy of the information you entered into online forms in Chrome.Restricted
https://www.googleapis.com/auth/dataportability.chrome.bookmarksMove a copy of pages you bookmarked in Chrome.Restricted
https://www.googleapis.com/auth/dataportability.chrome.dictionaryMove a copy of words you added to Chrome's dictionary.Sensitive
https://www.googleapis.com/auth/dataportability.chrome.extensionsMove a copy of extensions you installed from the Chrome Web Store.Sensitive
https://www.googleapis.com/auth/dataportability.chrome.historyMove a copy of sites you visited in Chrome.Restricted
https://www.googleapis.com/auth/dataportability.chrome.reading_listMove a copy of pages you added to your reading list in Chrome.Sensitive
https://www.googleapis.com/auth/dataportability.chrome.settingsMove a copy of your settings in Chrome.Sensitive
https://www.googleapis.com/auth/dataportability.discover.followsMove a copy of searches and sites you follow, saved by Discover.Sensitive
https://www.googleapis.com/auth/dataportability.discover.likesMove a copy of links to your liked documents, saved by Discover.Sensitive
https://www.googleapis.com/auth/dataportability.discover.not_interestedMove a copy of content you marked as not interested, saved by Discover.Sensitive
https://www.googleapis.com/auth/dataportability.maps.aliased_placesMove a copy of the places you labeled on Maps.Restricted
https://www.googleapis.com/auth/dataportability.maps.commute_routesMove a copy of your pinned trips on Maps.Restricted
https://www.googleapis.com/auth/dataportability.maps.commute_settingsMove a copy of your commute settings on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.ev_profileMove a copy of your electric vehicle profile on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.factual_contributionsMove a copy of the corrections you made to places or map information on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.offering_contributionsMove a copy of your updates to places on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.photos_videosMove a copy of the photos and videos you posted on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.questions_answersMove a copy of the questions and answers you posted on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.reviewsMove a copy of your reviews and posts on Maps.Sensitive
https://www.googleapis.com/auth/dataportability.maps.starred_placesMove a copy of your Starred places list on Maps.Restricted
https://www.googleapis.com/auth/dataportability.myactivity.mapsMove a copy of your Maps activity.Restricted
https://www.googleapis.com/auth/dataportability.myactivity.myadcenterMove a copy of your My Ad Center activity.Sensitive
https://www.googleapis.com/auth/dataportability.myactivity.playMove a copy of your Google Play activity.Restricted
https://www.googleapis.com/auth/dataportability.myactivity.searchMove a copy of your Google Search activity.Restricted
https://www.googleapis.com/auth/dataportability.myactivity.shoppingMove a copy of your Shopping activity.Restricted
https://www.googleapis.com/auth/dataportability.myactivity.youtubeMove a copy of your YouTube activity.Restricted
https://www.googleapis.com/auth/dataportability.mymaps.mapsMove a copy of the maps you created in My Maps.Restricted
https://www.googleapis.com/auth/dataportability.order_reserve.purchases_reservationsMove a copy of your food purchase and reservation activity.Sensitive
https://www.googleapis.com/auth/dataportability.play.devicesMove a copy of information about your devices with Google Play Store installed.Sensitive
https://www.googleapis.com/auth/dataportability.play.groupingMove a copy of your Google Play Store Grouping tags created by app developers.Sensitive
https://www.googleapis.com/auth/dataportability.play.installsMove a copy of your Google Play Store app installations.Sensitive
https://www.googleapis.com/auth/dataportability.play.libraryMove a copy of your Google Play Store downloads, including books, games, and apps.Sensitive
https://www.googleapis.com/auth/dataportability.play.playpointsMove a copy of information about your Google Play Store Points.Sensitive
https://www.googleapis.com/auth/dataportability.play.promotionsMove a copy of information about your Google Play Store promotions.Sensitive
https://www.googleapis.com/auth/dataportability.play.purchasesMove a copy of your Google Play Store purchases.Restricted
https://www.googleapis.com/auth/dataportability.play.redemptionsMove a copy of your Google Play Store redemption activities.Sensitive
https://www.googleapis.com/auth/dataportability.play.subscriptionsMove a copy of your Google Play Store subscriptions.Sensitive
https://www.googleapis.com/auth/dataportability.play.usersettingsMove a copy of your Google Play Store user settings and preferences.Sensitive
https://www.googleapis.com/auth/dataportability.saved.collectionsMove a copy of your saved links, images, places, and collections from your use of Google services.Sensitive
https://www.googleapis.com/auth/dataportability.search_ugc.media.reviews_and_starsMove a copy of your media reviews on Google Search.Sensitive
https://www.googleapis.com/auth/dataportability.search_ugc.media.streaming_video_providersMove a copy of your self-reported video streaming provider preferences from Google Search and Google TV.Sensitive
https://www.googleapis.com/auth/dataportability.search_ugc.media.thumbsMove a copy of your indicated thumbs up and thumbs down on media in Google Search and Google TV.Sensitive
https://www.googleapis.com/auth/dataportability.search_ugc.media.watchedMove a copy of information about the movies and TV shows you marked as watched on Google Search and Google TV.Sensitive
https://www.googleapis.com/auth/dataportability.searchnotifications.settingsMove a copy of your notification settings on the Google Search app.Sensitive
https://www.googleapis.com/auth/dataportability.searchnotifications.subscriptionsMove a copy of your notification subscriptions on Google Search app.Sensitive
https://www.googleapis.com/auth/dataportability.shopping.addressesMove a copy of your shipping information on Shopping.Sensitive
https://www.googleapis.com/auth/dataportability.shopping.reviewsMove a copy of reviews you wrote about products or online stores on Google Search.Sensitive
https://www.googleapis.com/auth/dataportability.streetview.imageryMove a copy of the images and videos you uploaded to Street View.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.channelMove a copy of information about your YouTube channel.Restricted
https://www.googleapis.com/auth/dataportability.youtube.clipsMove a copy of your YouTube clips metadata.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.commentsMove a copy of your YouTube comments.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.live_chatMove a copy of your YouTube messages in live chat.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.musicMove a copy of your uploaded YouTube music tracks and your YouTube music library.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.playableMove a copy of your YouTube playables saved game progress files.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.postsMove a copy of your YouTube posts.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.private_playlistsMove a copy of your YouTube private playlists.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.private_videosMove a copy of your private YouTube videos and information about them.Restricted
https://www.googleapis.com/auth/dataportability.youtube.public_playlistsMove a copy of your public YouTube playlists.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.public_videosMove a copy of your public YouTube videos and information about them.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.shoppingMove a copy of your YouTube shopping wishlists, and wishlist items.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.subscriptionsMove a copy of your YouTube channel subscriptions, even if they're private.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.unlisted_playlistsMove a copy of your unlisted YouTube playlists.Sensitive
https://www.googleapis.com/auth/dataportability.youtube.unlisted_videosMove a copy of your unlisted YouTube videos and information about them.Sensitive