내보내기에 액세스 토큰의 전체 기간보다 오래 걸릴 수 있으며, 사용자가 30일 또는 180일의 액세스 권한을 부여할 수도 있습니다. 갱신 토큰을 가져와 정기적으로 새 액세스 토큰으로 교환해야 할 수 있습니다. 자세한 내용은 웹 앱의 액세스 토큰 갱신 및 모바일 및 데스크톱 앱의 액세스 토큰 갱신을 참고하세요.
중요: OAuth 클라이언트의 게시 상태가 테스트가 아닌 프로덕션인 경우에만 OAuth 토큰 갱신을 사용할 수 있습니다.
또한 테스트 게시 상태로 OAuth 클라이언트에 부여된 토큰은 30일 또는 180일 기간을 선택하더라도 항상 7일 후에 만료됩니다.
자세한 내용은 OAuth 동의 화면 설정을 참고하세요.
Data Portability API OAuth 범위
OAuth용 Data Portability API 애플리케이션을 구성할 때 애플리케이션과 관련된 Data Portability API OAuth 범위를 사용 설정합니다. 일부 범위는 sensitive 및 restricted이며 추가 요구사항이 적용됩니다.
OAuth 흐름에 Data Portability API 범위를 추가하면 사용자가 일부 범위에만 동의하는 경우가 있습니다. 앱은 다음과 같은 방식으로 이러한 케이스를 처리할 수 있어야 합니다.
부분 데이터 내보내기 허용
사용자에게 필요한 범위를 모두 선택하지 않았다고 알리고 적절하게 실패함
사용자에게 나머지 동의 요청
또한 사용자는 개발자에게 데이터 액세스 권한을 한 번 부여할지 아니면 30일 또는 180일 동안 부여할지 선택할 수 있습니다.
사용자가 일회성 액세스 권한을 부여하면 앱은 해당 동의에 따라 하나의 데이터 내보내기를 실행할 수 있습니다. 데이터를 다시 다운로드하려면 사용자의 새 동의가 필요합니다.
사용자가 시간 기반 액세스 권한을 부여하면 앱은 지정된 기간 동안 또는 사용자가 동의를 취소할 때까지 데이터 내보내기를 실행할 수 있습니다.
요청에 시간 필터를 적용하여 특정 기간(예: 지난 6개월)의 데이터를 내보낼 수도 있습니다.
또한 OAuth 흐름 중에 앱은 동의하는 데 사용된 Google 계정을 알 수 없습니다. 애플리케이션에서 수신하는 OAuth 토큰은 불투명합니다.
Data Portability API 범위 (예: https://www.googleapis.com/auth/dataportability.*) 요청은 다른 범위 (예: https://www.googleapis.com/auth/userinfo.email)와 혼합할 수 없습니다. 다음은 제한된 부분이 굵게 표시된 잘못된 요청의 예입니다.
요청에 추가된 범위가 너무 많으면 400 bad request 오류가 발생할 수 있습니다. URL 길이가 브라우저에서 지원하는 길이를 초과하면 이 오류가 발생합니다. 이 문제를 해결하려면 범위에 대한 요청을 여러 개의 소규모 일괄 처리로 분할하고 증분 승인을 사용하여 각 일괄 처리에 대한 동의를 요청하세요.
범위 카테고리
Data Portability API에서 지원하는 모든 OAuth 범위 및 카테고리의 목록은 사용 가능한 OAuth 범위를 참고하세요. 특정 서비스에서 지원하는 모든 리소스 그룹 및 OAuth 범위의 목록은 해당 서비스의 스키마 참조 페이지를 참고하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eTo use the Data Portability API, set up an OAuth workflow for your application using Google Identity documentation guidance for web, JavaScript, or mobile/desktop apps.\u003c/p\u003e\n"],["\u003cp\u003eEnable specific Data Portability API OAuth scopes for the desired data access, noting some scopes have restrictions and require additional handling for partial user consent.\u003c/p\u003e\n"],["\u003cp\u003eUser consent allows one data export; new consent is needed for subsequent downloads, and applications cannot directly identify the consenting Google Account due to token opacity.\u003c/p\u003e\n"],["\u003cp\u003eWhen requesting Data Portability API scopes, avoid mixing them with other scopes and refrain from using \u003ccode\u003einclude_granted_scopes=true\u003c/code\u003e to prevent errors.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the schema reference page or the Restricted Scopes page for a comprehensive list of all OAuth scopes and their categories within the Data Portability API.\u003c/p\u003e\n"]]],[],null,["# Configure OAuth for your application\n\nTo configure OAuth for your application, you set up an OAuth workflow, and you\nenable the Data Portability API OAuth scopes.\n\nSet up an OAuth workflow\n------------------------\n\nTo set up an OAuth flow for your application, follow the [basic steps](https://developers.google.com/identity/protocols/oauth2#basicsteps) in\nthe Google Identity documentation.\n\nMost developers use the [Server-side Web Apps](https://developers.google.com/identity/protocols/oauth2/web-server) flow for obtaining OAuth\nconsent, but you can also use the [JavaScript Web Apps flow](https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow) or the\n[Mobile and Desktop Apps flow](https://developers.google.com/identity/protocols/oauth2/native-app).\n\nExports can take longer than the lifetime of an access token, or the user could\ngrant 30 or 180 days of access. You may need to obtain a refresh token and\nperiodically exchange it for a fresh access token. For more details, see\n[Refreshing an access token for Web Apps](https://developers.google.com/identity/protocols/oauth2/web-server#offline) and\n[Refreshing an access token for Mobile and Desktop Apps](https://developers.google.com/identity/protocols/oauth2/native-app#offline).\n\n**Important** : OAuth token renewal is only available to users if your OAuth\nclient has a publishing status of **In production** , not **Testing** .\nAdditionally, tokens granted to OAuth clients with a **Testing** publishing\nstatus *always expire in 7 days* even if you select a 30- or 180-day duration.\nFor details, see [Setting up your OAuth consent screen](https://support.google.com/cloud/answer/10311615?sjid=1423889632047624286-NC#zippy=%2Cin-production).\n\nData Portability API OAuth scopes\n---------------------------------\n\nWhen you configure your Data Portability API application for OAuth, enable the\nData Portability API OAuth scopes that are relevant to your application. Some scopes\nare `sensitive` and `restricted` and are subject to additional requirements.\n\nWhen you add the Data Portability API scopes to your OAuth flow, there may be cases\nwhere your user gives consent to some but not all of the scopes. Your app must\nbe able to handle these cases by:\n\n- Allowing partial data exports\n- Notifying the user that they didn't select all the necessary scopes (and failing gracefully)\n- Asking the user for the remaining consents\n\nAdditionally, a user chooses whether to grant you access to their data once, or\nfor 30 or 180 days.\n\n- If a user grants you one-time access, your app is allowed to perform **one** data export for that specific consent. To download the data again, you need a new consent from the user.\n- If a user grants you time-based access, your app is allowed to perform data exports for the duration of specified time period or until the user revokes consent.\n- You can also choose to apply [time filters](/data-portability/user-guide/time-filter) to your request to export data for a specific range of time, such as the last 6 months.\n\nYou should also note that during the OAuth flow, your app does not know which\nGoogle Account was used to give consent. The OAuth token your application\nreceives is opaque.\n\nIf you are looking for information on how users share data, see [Share a copy of\nyour data with a third party](https://support.google.com/accounts/answer/14452558).\n\n### Scopes restrictions\n\nThis section covers restrictions in scopes that result in errors.\n\n#### Mixed scopes\n\nRequests for Data Portability API scopes (such as,\nhttps://www.googleapis.com/auth/dataportability.\\*) can't be mixed with other\nscopes (such as, https://www.googleapis.com/auth/userinfo.email). Here is an\nexample of a bad request, with the restricted part bolded: \n\n https://accounts.google.com/o/oauth2/v2/auth?\n client_id=\u003cvar translate=\"no\"\u003eclient_id\u003c/var\u003e&\n redirect_uri=\u003cvar translate=\"no\"\u003eredirect_uri\u003c/var\u003e&\n response_type=token&\n scope=https://www.googleapis.com/auth/dataportability.myactivity.search+https://www.googleapis.com/auth/userinfo.email&\n include_granted_scopes=false\n\n#### Previously granted scopes\n\nYou should never set `include_granted_scopes=true` when requesting DPAPI scopes.\nHere is an example of a bad request, with the restricted part bolded: \n\n https://accounts.google.com/o/oauth2/v2/auth?\n client_id=\u003cvar translate=\"no\"\u003eclient_id\u003c/var\u003e&\n redirect_uri=\u003cvar translate=\"no\"\u003eredirect_uri\u003c/var\u003e&\n response_type=token&\n scope=https://www.googleapis.com/auth/dataportability.myactivity.search&\n include_granted_scopes=true\n\n#### Too many scopes\n\nIf your request has too many scopes appended, you may encounter a\n`400 bad request` error. This occurs when the URL length grows beyond what is\nsupported in browsers. To resolve, split your requests for scopes into multiple\nsmaller batches and use [Incremental authorization](https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow#incrementalAuth) to request\nconsent for each batch.\n| **Tip:** The length of the request is variable based on the length of the scopes. If the request fails, reduce the number of scopes and try again.\n\n### Scopes categories\n\nFor list of all OAuth scopes supported by the Data Portability API and their\ncategories, see [Available OAuth scopes](/data-portability/user-guide/scopes). For a list of all resource\ngroups and OAuth scopes supported by a particular service, see the [schema\nreference page](/data-portability/schema-reference) for that service.\n| **Tip:** If you want to view only the `restricted` scopes, see the Google Cloud Consoles's [Restricted Scopes page](https://support.google.com/cloud/answer/13464325#zippy=%2Cdata-portability-api)."]]