API 탐색기의 사용자 인증 정보 섹션을 사용하면 다양한 사용자 인증 정보와 범위로 테스트할 수 있습니다. 이 기능은 API 엔드포인트를 호출하는 데 필요한 최소한의 사용자 인증 정보와 범위를 사용하는 데 유용합니다.
다른 사용자 인증 정보로 테스트
기본적으로 OAuth 2 및 API 키 사용자 인증 정보 유형이 모두 선택되어 있습니다.
사용자 인증 정보 하나로만 테스트하려면 사용할 사용자 인증 정보 유형을 선택하고 다른 사용자 인증 정보 유형은 선택 해제합니다. 테스트에 사용할 사용자 인증 정보를 선택하는 일반적인 규칙은 다음과 같습니다.
Google 지도 데이터와 같은 공개 데이터에 액세스하는 방법을 사용하는 경우 API 키를 사용자 인증 정보로 사용할 수 있습니다. API 키를 선택하고 Google OAuth 2.0을 선택 해제합니다.
사용자의 Google Drive 데이터와 같은 비공개 데이터에 액세스하는 방법을 사용하는 경우 OAuth 2 인증 정보를 사용해야 합니다. API 키를 선택 해제하고 Google OAuth 2.0을 선택합니다.
결과가 200이면 데이터에 액세스하기에 사용자 인증 정보가 충분합니다. 결과가 401인 경우 OAuth 2 사용자 인증 정보를 사용하여 데이터에 액세스해야 합니다.
다양한 범위로 테스트
범위는 https://www.googleapis.com/auth/drive.metadata.readonly와 같은 문자열로, 사용자 소유 데이터에 대한 액세스 수준과 같이 앱에 필요한 리소스에 대한 액세스 수준을 정의합니다. 앱이 사용자 데이터에 대한 액세스 수준이 가장 좁은 범위를 사용해야 합니다. 메서드에 따라 다른 범위가 필요할 수 있습니다. 예를 들어 API의 한 메서드에는 최소한 읽기 전용 범위가 필요하지만 다른 메서드에는 읽기-쓰기 범위가 필요할 수 있습니다.
기본적으로 API 탐색기에서는 API의 모든 Google OAuth 2.0 범위가 사용 설정됩니다. 특정 범위로 테스트하려면 다음 단계를 따르세요.
사용자 인증 정보 Google OAuth 2.0 섹션에서 범위 표시를 클릭합니다.
메서드를 호출할 때 사용할 범위를 확인합니다.
실행을 클릭하여 선택한 범위만 사용하여 API를 실행합니다. API 탐색기에 범위를 사용할 액세스 권한을 부여하라는 승인 화면이 표시됩니다.
허용을 클릭합니다. 결과는 '실행' 버튼 아래에 표시됩니다.
API 탐색기에 'application/json' 아래에 200 결과가 표시되면 메서드를 호출하기에 범위가 충분합니다. API 탐색기에 403 결과가 표시되면 메서드를 호출하기에 범위가 부족한 것입니다. 더 넓은 범위를 시도해 보세요.
범위 선택에 관한 자세한 내용은 특정 Google API의 문서에 있는 인증 및 승인 섹션을 참고하세요.
새 범위로 테스트하기 위해 승인된 액세스 권한 취소
Google 승인 화면을 사용하여 승인을 승인한 후에는 사용자 인증 정보가 만료되지 않는 한 API 탐색기가 인증된 요청을 할 수 있는 권한이 유지됩니다. 범위를 선택 해제해도 이전에 승인된 사용자 인증 정보와 범위는 재설정되지 않습니다. 새 범위 구성으로 테스트하려면 이전에 승인된 사용자 인증 정보를 취소해야 합니다.
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThe API Explorer's credentials section allows testing with different credentials (API key or Google OAuth 2.0) and scopes to ensure minimal access requirements.\u003c/p\u003e\n"],["\u003cp\u003eAPI keys are suitable for accessing public data, while OAuth 2.0 credentials are necessary for private data access.\u003c/p\u003e\n"],["\u003cp\u003eUsing the scopes feature, you can select specific access levels (read-only, read-write, etc.) and verify their sufficiency for invoking API methods.\u003c/p\u003e\n"],["\u003cp\u003eTo test with new scopes, you may need to revoke previously approved credentials through your Google account settings.\u003c/p\u003e\n"]]],[],null,["# Test with different credential types and scopes\n\nThe APIs Explorer's credentials section lets you test with different\ncredentials and scopes. This feature is useful in ensuring you're using the\nminimal required credentials and scope to invoke an API endpoint.\n\nTest with different credentials\n-------------------------------\n\nBy default, both the OAuth 2 and API Key credential types are checked.\nIf you want to test with only one credential, check on the credential type to\nuse (and uncheck the other credential type). Following are the general rules for\npicking a credential to test with:\n\n- If you're using a method to access public data, such as Google Maps data, you\n can use an API key as your credential. Check **API key** and uncheck\n **Google OAuth 2.0**.\n\n- If you're using a method to access private data, such as the user's Google\n Drive data, you must use an OAuth 2 credential. Uncheck **API key** and check\n **Google OAuth 2.0**.\n\nIf you receive a result of 200, the credential is sufficient\nfor accessing the data. If you receive a result of 401, you need\nto use OAuth 2 credential to access the data.\n\nTest with different scopes\n--------------------------\n\nA scope is a string, such as\n`https://www.googleapis.com/auth/drive.metadata.readonly`, defining a level of\naccess to resources required by your app, such as the level of access to data\nowned by the users. Ideally, you want your app to use scopes with\nthe narrowest level of access to the user's data. Different methods might\nrequire different scopes. For example, a method in an API might require\nat least a read-only scope, while other methods might require a read-write\nscope.\n| **Note:** Scopes are only applicable to Google OAuth 2.0. If you're testing with an API key, you won't test with different scopes.\n\nBy default, all Google OAuth 2.0 scopes for an API are enabled in the APIs\nExplorer. To test with a specific scope:\n\n1. In the Credentials Google OAuth 2.0 section, click **show scopes**.\n2. Check the scope to use when invoking the method.\n3. Click **Execute** to execute the API using only the selected scope. The APIs Explorer shows an authorization screen asking you to grant access to use the scope.\n4. Click **Allow**. The results appear below the Execute button.\n\nIf the APIs Explorer shows a result of 200 under an \"application/json\", then the\nscope is sufficient to invoke the method. If the APIs Explorer shows an\nresult of 403, you have chosen an insufficient scope to invoke the method. Try\na broader scope.\n\nFor additional information on scope selection, refer to the authentication and\nauthorization section of documentation for your specific Google API.\n\n### Revoke authorized access to test with new scopes\n\nAfter you have used the Google authorization screen to approve authorization,\nthe APIs Explorer remains authorized to make authenticated requests as long\nas the credentials aren't expired. Unchecking scopes doesn't reset the\npreviously approved credentials and scopes. If you want to test with a new\nscope configuration, you must revoke your previously approved credentials.\n\nTo revoke the credentials used by the APIs Explorer:\n\n1. Navigate to [Apps with access to your account](https://www.google.com/accounts/IssuedAuthSubTokens).\n2. Under **Third-party apps with account access** , click **Google APIs Explorer**.\n3. Click **Remove Access**.\n4. (optional) Reload the documentation page to reset the APIs Explorer."]]