빠른 시작에서는 Google Workspace API를 호출하는 앱을 설정하고 실행하는 방법을 설명합니다.
Google Workspace 빠른 시작에서는 API 클라이언트 라이브러리를 사용하여 인증 및 승인 흐름의 일부 세부정보를 처리합니다. 자체 앱에는 클라이언트 라이브러리를 사용하는 것이 좋습니다. 이 빠른 시작에서는 테스트 환경에 적합한 간소화된 인증 접근 방식을 사용합니다. 프로덕션 환경의 경우 앱에 적합한 액세스 사용자 인증 정보를 선택하기 전에 인증 및 승인에 관해 알아보는 것이 좋습니다.
/** * List login events for a Google Workspace domain. * @see https://developers.google.com/admin-sdk/reports/reference/rest/v1/activities/list */functionlistLogins(){constuserKey='all';constapplicationName='login';constoptionalArgs={maxResults:10};try{constresponse=AdminReports.Activities.list(userKey,applicationName,optionalArgs);constactivities=response.items;if(!activities||activities.length===0){console.log('Nologinsfound.');return;}// Print login eventsconsole.log('Logins:');for(constactivityofactivities){console.log('%s:%s(%s)',activity.id.time,activity.actor.email,activity.events[0].name);}}catch(err){// TODO (developer)- Handle exception from the Report APIconsole.log('Failedwitherror%s',err.message);}}
[null,null,["최종 업데이트: 2025-01-29(UTC)"],[[["This quickstart demonstrates how to use Google Apps Script to access the Admin SDK Reports API and list login events for a Google Workspace domain."],["Before running the script, you will need a Google Workspace domain with API access enabled, a Google Account with administrator privileges, and access to Google Drive."],["The script uses a simplified authentication approach for testing; for production environments, review authentication and authorization best practices before selecting credentials."],["To run the script, you need to enable the Admin SDK API within the Apps Script project and authorize access when prompted."],["After successful execution, the script will output login events to the execution log in the Apps Script editor."]]],[]]