클라이언트 보안 비밀번호
컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
.NET용 Google API 클라이언트 라이브러리는 client_secrets.json
파일을 사용하여 client_id
, client_secret
및 기타 OAuth 2.0 매개변수.
client_secrets.json
파일은 JSON 형식의 파일입니다. 클라이언트 ID, 클라이언트 비밀번호, 기타 OAuth 2.0 매개변수가 포함됩니다. 다음은 웹 애플리케이션의 client_secrets.json
파일 예입니다.
{ "web": { "client_id": "asdfjasdljfasdkjf", "client_secret": "1912308409123890", "redirect_uris": ["https://www.example.com/oauth2callback"], "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://accounts.google.com/o/oauth2/token" } }
다음은 설치된 애플리케이션의 client_secrets.json
파일 예입니다.
{ "installed": { "client_id": "837647042410-75ifg...usercontent.com", "client_secret":"asdlkfjaskd", "redirect_uris": ["http://localhost"], "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://accounts.google.com/o/oauth2/token" } }
형식은 다음 두 가지 클라이언트 ID 유형 중 하나를 정의합니다.
web
: 웹 애플리케이션 installed
: 설치된 애플리케이션.
web
및 installed
하위 객체에는 다음 필수 멤버를 포함해야 합니다.
-
client_id
(문자열): 클라이언트 ID입니다. -
client_secret
(문자열): 클라이언트 보안 비밀번호입니다.
이 파일의 다른 모든 멤버는 선택 사항이며 .NET 클라이언트 라이브러리는 이를 사용하지 않습니다.
동기
일반적으로 OAuth 2.0 엔드포인트 제공업체는 자신의 서비스를 사용하여 클라이언트 ID를 복사하여 붙여넣는 사용자 클라이언트 비밀번호를 작업 코드에 입력합니다. 이 방법은 오류가 발생하기 쉬우며 불완전한 그림을 제공합니다. 필요한 정보를 수집합니다. (또한 OAuth 2.0은 모든 엔드포인트를 알아야 하므로 리디렉션 URI 구성에 대해 살펴볼 수 있습니다.) 서비스 제공업체에서 다운로드 가능한 client_secrets.json
을 제공하는 경우 클라이언트 라이브러리는 이러한 파일을 사용할 준비가 되어 있으므로 OAuth 2.0을 구현하면 더 쉽고 오류도 줄어듭니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[[["이해하기 쉬움","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-26(UTC)"],[[["\u003cp\u003eThe Google APIs client library for .NET utilizes \u003ccode\u003eclient_secrets.json\u003c/code\u003e files to store OAuth 2.0 credentials like \u003ccode\u003eclient_id\u003c/code\u003e, \u003ccode\u003eclient_secret\u003c/code\u003e, and other parameters.\u003c/p\u003e\n"],["\u003cp\u003eThese JSON files define client ID types as either \u003ccode\u003eweb\u003c/code\u003e for web applications or \u003ccode\u003einstalled\u003c/code\u003e for installed applications, each requiring \u003ccode\u003eclient_id\u003c/code\u003e and \u003ccode\u003eclient_secret\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eclient_secrets.json\u003c/code\u003e files simplifies OAuth 2.0 implementation by providing a centralized, downloadable configuration instead of manual entry, reducing errors.\u003c/p\u003e\n"]]],[],null,["The Google APIs client library for .NET uses\n`client_secrets.json` files for storing the\n`client_id`, `client_secret`, and other OAuth 2.0 parameters.\n\nA `client_secrets.json`\nfile is a [JSON](http://www.json.org/) formatted file\ncontaining the client ID, client secret, and other OAuth 2.0 parameters.\nHere is an example `client_secrets.json` file for a web application: \n\n```\n{\n \"web\": {\n \"client_id\": \"asdfjasdljfasdkjf\",\n \"client_secret\": \"1912308409123890\",\n \"redirect_uris\": [\"https://www.example.com/oauth2callback\"],\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://accounts.google.com/o/oauth2/token\"\n }\n}\n```\n\n\nHere is an example `client_secrets.json` file for an installed application: \n\n```\n{\n \"installed\": {\n \"client_id\": \"837647042410-75ifg...usercontent.com\",\n \"client_secret\":\"asdlkfjaskd\",\n \"redirect_uris\": [\"http://localhost\"],\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://accounts.google.com/o/oauth2/token\"\n }\n}\n```\n\n\nThe format defines one of two client ID types:\n\n- `web`: Web application.\n- `installed`: Installed application.\n\n\nThe `web` and `installed` sub-objects have\nthe following mandatory members:\n\n- `client_id` (string): The client ID.\n- `client_secret` (string): The client secret.\n\n\nAll the other members of this file are optional and\nthe .NET client library doesn't use them.\n\nMotivation\n\n\nTraditionally, providers of OAuth 2.0 endpoints have expected\nthose who use their services to copy and paste the client ID\nand client secret from a registration page into working code.\nThis method is error-prone and gives an incomplete picture\nof the information that is needed to get OAuth 2.0 working.\n(OAuth 2.0 also requires knowing all the endpoints,\nand configuring a redirect URI.)\n\nIf service providers provide downloadable `client_secrets.json`\nfiles, and client libraries are prepared to consume these files,\nthen implementing OAuth 2.0 will be easier and less prone to error."]]