Enum AuthMode
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
인증모드
Apps Script가 트리거된 함수를 통해 실행할 수 있는 승인된 서비스의 카테고리를 식별하는 열거형입니다. 이러한 값은 트리거된 함수에서 이벤트 매개변수 e
의 authMode
속성으로 노출됩니다. 자세한 내용은 부가기능 승인 수명 주기에 관한 가이드를 참고하세요.
enum을 호출하려면 상위 클래스, 이름, 속성을 호출합니다. 예를 들면
ScriptApp.AuthMode.CUSTOM_FUNCTION
입니다.
function onOpen(e) {
const menu = SpreadsheetApp.getUi().createAddonMenu();
if (e && e.authMode === ScriptApp.AuthMode.NONE) {
// Add a normal menu item (works in all authorization modes).
menu.addItem('Start workflow', 'startWorkflow');
} else {
// Add a menu item based on properties (doesn't work in AuthMode.NONE).
const properties = PropertiesService.getDocumentProperties();
const workflowStarted = properties.getProperty('workflowStarted');
if (workflowStarted) {
menu.addItem('Check workflow status', 'checkWorkflow');
} else {
menu.addItem('Start workflow', 'startWorkflow');
}
// Record analytics.
UrlFetchApp.fetch('http://www.example.com/analytics?event=open');
}
menu.addToUi();
}
속성
속성 | 유형 | 설명 |
NONE | Enum | 승인이 필요한 서비스에 대한 액세스를 허용하지 않는 모드입니다. 이 모드는 부가기능이 onOpen(e) 간단한 트리거를 실행하고 사용자가 다른 문서에 부가기능을 설치했지만 현재 문서에서 부가기능을 사용하지 않은 경우에 발생합니다. |
CUSTOM_FUNCTION | Enum | 맞춤 스프레드시트 함수에 사용할 수 있도록 제한된 서비스 하위 집합에 액세스할 수 있는 모드입니다. 이러한 서비스 중 일부(스프레드시트 서비스에 대한 읽기 전용 액세스 포함)는 일반적으로 승인이 필요하지만 맞춤 함수에서 사용하면 승인 없이 허용됩니다. 맞춤 함수에는 이벤트 매개변수가 포함되지 않으므로 이 값은 반환되지 않습니다. 맞춤 함수가 자체 승인 모드에서 실행된다는 것을 보여주기 위해 문서화되어 있습니다. |
LIMITED | Enum | 제한된 서비스 하위 집합에 대한 액세스를 허용하는 모드입니다. 이 모드는 문서에 바인딩된 부가기능 또는 스크립트가 onOpen(e) 또는 onEdit(e) 간단한 트리거를 실행할 때 발생합니다(NONE 에 설명된 경우 제외). |
FULL | Enum | 승인이 필요한 모든 서비스에 액세스할 수 있는 모드입니다. 이 모드는 LIMITED 또는 NONE 에 설명된 사례 이외의 트리거의 결과로 부가기능 또는 스크립트가 실행될 때 발생합니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eAuthMode defines the level of access Apps Script has to authorized services when a triggered function is executed.\u003c/p\u003e\n"],["\u003cp\u003eIt's crucial for understanding how add-ons and scripts interact with Google services, especially concerning user authorization.\u003c/p\u003e\n"],["\u003cp\u003eDifferent AuthModes like NONE, LIMITED, and FULL, dictate the scope of service access, impacting functionalities within triggered functions.\u003c/p\u003e\n"],["\u003cp\u003eCustom functions operate under a specific authorization mode that allows restricted access to certain services without explicit user authorization.\u003c/p\u003e\n"]]],[],null,["# Enum AuthMode\n\nAuthMode\n\nAn enumeration that identifies which categories of authorized services Apps Script is able to\nexecute through a triggered function. These values are exposed in [triggered functions](/apps-script/understanding_triggers) as the `auth``Mode`\nproperty of the [event parameter](/apps-script/understanding_events), `e`. For\nmore information, see the [guide to the\nauthorization lifecycle for add-ons](/gsuite/add-ons/concepts/addon-authorization#authorization_modes).\n\nTo call an enum, you call its parent class, name, and property. For example, `\nScriptApp.AuthMode.CUSTOM_FUNCTION`.\n\n```javascript\nfunction onOpen(e) {\n const menu = SpreadsheetApp.getUi().createAddonMenu();\n if (e && e.authMode === ScriptApp.AuthMode.NONE) {\n // Add a normal menu item (works in all authorization modes).\n menu.addItem('Start workflow', 'startWorkflow');\n } else {\n // Add a menu item based on properties (doesn't work in AuthMode.NONE).\n const properties = PropertiesService.getDocumentProperties();\n const workflowStarted = properties.getProperty('workflowStarted');\n if (workflowStarted) {\n menu.addItem('Check workflow status', 'checkWorkflow');\n } else {\n menu.addItem('Start workflow', 'startWorkflow');\n }\n // Record analytics.\n UrlFetchApp.fetch('http://www.example.com/analytics?event=open');\n }\n menu.addToUi();\n}\n``` \n\n### Properties\n\n| Property | Type | Description |\n|-------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `NONE` | `Enum` | A mode that does not allow access to any services that require authorization. This mode occurs when an add-on executes an `on``Open(e)` simple trigger, and the user has installed an add-on in a different document but the add-on has not been used in the current document. |\n| `CUSTOM_FUNCTION` | `Enum` | A mode that allows access to a limited subset of services for use in custom spreadsheet functions. Some of these services --- including read-only access to Spreadsheet service --- normally require authorization, but are permitted without authorization when used in a custom function. Because custom functions do not include an event parameter, this value is never returned; it is documented only to demonstrate that custom functions run in their own authorization mode. |\n| `LIMITED` | `Enum` | A mode that allows access to a limited subset of services. This mode occurs when an add-on or a script [bound](/apps-script/scripts_containers) to a document executes an `on``Open(e)` or `on``Edit(e)` simple trigger, except in the case described for `NONE`. |\n| `FULL` | `Enum` | A mode that allows access to all services that require authorization. This mode occurs when an add-on or a script executes as the result of any trigger other than the cases described for `LIMITED` or `NONE`. |"]]