Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk menggunakan Chrome Printer Management API, Anda perlu mengaktifkan API dan membuat kredensial OAuth
2.0 aplikasi. Kemudian,
administrator Chrome
harus memberikan akses akun yang diperlukan ke skrip Anda untuk mengelola printer.
Admin dapat memblokir atau memercayai aplikasi yang dikembangkan untuk mengelola printer
untuk akun mereka.
Ikuti langkah-langkah di bawah untuk menyiapkan semua yang diperlukan untuk akses API. Petunjuk
ini mengasumsikan bahwa Anda sudah memiliki aplikasi dengan layar izin OAuth yang telah
disiapkan, dan akun layanan yang telah disiapkan. Jika tidak, lihat
Mengonfigurasi izin OAuth dan
Membuat akun layanan
sebelum melanjutkan.
Mengaktifkan API dan membuat kredensial
Aktifkan API.
API yang Anda aktifkan adalah "Admin SDK".
Buat kredensial OAuth 2.0
untuk akun layanan Anda. Simpan file JSON yang didownload di lokasi yang aman.
Mengaktifkan akses akun layanan
Sebelum digunakan, akun layanan Anda harus diberi hak istimewa admin
yang sesuai. Tindakan ini harus dilakukan oleh administrator untuk pelanggan
yang terkait dengan printer atau server cetak yang dikelola akun layanan.
Opsi 1: Mengaktifkan delegasi tingkat domain untuk akun layanan
Delegasi tingkat domain memungkinkan akun layanan meniru identitas admin yang
memiliki hak istimewa yang sesuai untuk mengelola printer dan server cetak.
Cakupan OAuth yang Anda perlukan untuk langkah ini adalah
https://www.googleapis.com/auth/admin.chrome.printers.
Opsi 2: Berikan hak istimewa peran admin ke akun layanan
Jika memilih untuk membatasi hak istimewa akun layanan di domain, Anda dapat menetapkan peran dengan hak istimewa untuk hanya mengelola printer. Untuk mempelajari lebih lanjut cara menggunakan peran untuk kontrol akses, lihat Mengelola peran.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-03-25 UTC."],[],[],null,["# Get started\n\nTo use the Chrome Printer Management API, you need to enable the API and create the app's OAuth\n2.0 credentials. Then a\n[Chrome administrator](https://support.google.com/a/answer/6208960)\nneeds to grant your script the necessary account access to manage printers.\nAdmins can optionally block or trust apps developed to manage printers\nfor their account.\n\nFollow the steps below to set up everything required for API access. These\ninstructions assume you already have an app with its OAuth consent screen set\nup, and a service account set up. If that's not the case, see\n[Configure OAuth consent](/workspace/guides/configure-oauth-consent) and\n[Create a service account](/workspace/guides/create-credentials#create_a_service_account)\nbefore continuing.\n| **Note:** Only service accounts can access the Chrome Printer Management API at this time.\n\nEnable API and create credentials\n---------------------------------\n\n1. [Enable the API](/workspace/guides/enable-apis). The API you are enabling is \"Admin SDK.\"\n2. [Create OAuth 2.0 credentials](/workspace/guides/create-credentials#create_credentials_for_a_service_account) for your service account. Store the downloaded JSON file in a secure location.\n\nEnable service account access\n-----------------------------\n\nBefore use, your service account needs to be granted proper admin\nprivileges. This must be done by an administrator for the customer\nassociated with the printers or print servers that the service account manages.\n\n### Option 1: Enable domain-wide delegation for the service account\n\nDomain-wide delegation lets the service account impersonate an admin who\nhas the proper privileges to manage printers and print servers.\n\n[Enable domain-wide delegation](/workspace/guides/create-credentials#optional_set_up_domain-wide_delegation_for_a_service_account)\n\nThe OAuth scope you need for this step is\n`https://www.googleapis.com/auth/admin.chrome.printers`.\n| **Note:** Depending on your app, you might need to enter additional scopes. For example, you might need to list scopes for the [Chrome Policy API](/chrome/policy)or the [Directory API](/workspace/admin/directory) (to view or manage organizational units).\n\n### Option 2: Grant admin role privileges to the service account\n\nIf you prefer to limit the service account's privileges on the domain, you can\nassign it a role with privileges to only manage printers. To learn more about\nusing roles for access control, see\n[Manage roles](/workspace/admin/directory/v1/guides/manage-roles).\n\n1. As an administrator, sign in to the [Admin console](https://admin.google.com/).\n2. At the top left of the page, click menu \\\u003e **Account** \\\u003e **Admin\n roles**.\n3. Select an existing role with the privilege below, or create a new role and\n add this privilege:\n\n `Services \u003e ChromeOS \u003e Settings \u003e Manage Printers`\n4. Assign this role to the service account email address.\n\nBlock or trust a printer management app\n---------------------------------------\n\nApps are trusted by default, but an administrator can choose to block or trust\nspecific apps for their account.\n\n1. As an administrator, sign in to the [Admin console](https://admin.google.com/).\n2. At the top left, click Menu menu \\\u003e **Security** \\\u003e **Access and data control** \\\u003e **API controls**.\n3. In the \"App access control\" section, click **Manage Third-party App Access**.\n4. In the \"Connected apps\" section:\n - If you don't see the app listed, click **Configure new app**. Then, follow the on-screen instructions.\n - If you see the app listed, click the app name. Then, select blocked or trusted under \"App Access\" and click **Save**."]]