Panduan Memulai
Salin prompt setup yang berisi langkah install dan panduan markdown lengkap untuk plugin ini.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-intune`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/intune/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Instalasi
Bagian berjudul “Instalasi”Anda bisa menggunakan AI-Assisted Setup kami untuk menginstal plugin ini. Tambahkan skill Capgo ke tool AI Anda dengan command berikut:
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-intune` plugin in my project.Jika Anda lebih memilih Manual Setup, instal plugin dengan menjalankan perintah berikut dan ikuti petunjuk khusus platform di bawah ini:
-
Instal package
Jendela terminal bun add @capgo/capacitor-intune -
Sinkronkan proyek native
Jendela terminal bunx cap sync -
Setup Intune native lengkap Ikuti halaman khusus Setup iOS dan Setup Android tersebut. Intune tetap memerlukan konfigurasi native host app untuk brokered auth, redirect URIs, manifests, entitlements, dan konfigurasi MSAL.
Mulai cepat
Bagian berjudul “Mulai cepat”import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.acquireToken({ scopes: ['openid'] });// The result holds sensitive values: use it without logging it.Contoh: acquireTokenSilent
Bagian berjudul “Contoh: acquireTokenSilent”import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.acquireTokenSilent({ scopes: ['openid'], accountId: 'acquireToken',});// The result holds sensitive values: use it without logging it.Contoh: registerAndEnrollAccount
Bagian berjudul “Contoh: registerAndEnrollAccount”import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.registerAndEnrollAccount({ accountId: 'account-id-123' });Kesalahan umum
Bagian berjudul “Kesalahan umum”- Listener: hapus handle saat screen unmount.
- Sinkronisasi Native: jalankan
bunx cap syncsetelah upgrade plugin. - Sumber kebenaran tunggal: percayai
src/definitions.tsdi repo GitHub.
Persyaratan
Bagian berjudul “Persyaratan”- Capacitor 8+
- Android dengan Intune Android SDK
12.0.3 - iOS dengan Intune iOS SDK
21.5.1 - Target deployment iOS
17.0+
Dokumentasi Intune Ionic saat ini menyebutkan batas waktu 19 Januari 2026 untuk aplikasi yang di-build dengan Xcode 26, yang mewajibkan Intune iOS SDK 21.1.0+. Plugin ini sudah menggunakan 21.5.1.
Penggunaan Dasar
Bagian berjudul “Penggunaan Dasar”import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.addListener('appConfigChange', (result) => { console.log('App config changed', result.accountId);});
await IntuneMAM.addListener('policyChange', (result) => { console.log('Policy changed', result.accountId);});
const auth = await IntuneMAM.acquireToken({ scopes: ['https://graph.microsoft.com/.default'], loginHint: 'alex@example.com',});
await IntuneMAM.registerAndEnrollAccount({ accountId: auth.accountId,});
const appConfig = await IntuneMAM.appConfig({ accountId: auth.accountId,});
const policy = await IntuneMAM.getPolicy({ accountId: auth.accountId,});
console.log({ auth, appConfig, policy });Alur Umum
Bagian berjudul “Alur Umum”Sign-in dan enrollment interaktif
Bagian berjudul “Sign-in dan enrollment interaktif”const auth = await IntuneMAM.acquireToken({ scopes: ['https://graph.microsoft.com/.default'],});
await IntuneMAM.registerAndEnrollAccount({ accountId: auth.accountId,});Refresh token senyap
Bagian berjudul “Silent token refresh”const token = await IntuneMAM.acquireTokenSilent({ accountId: 'AAD_OBJECT_ID', scopes: ['https://graph.microsoft.com/.default'], forceRefresh: true,});Baca akun yang saat ini terdaftar
Bagian berjudul “Baca akun yang saat ini terdaftar”const user = await IntuneMAM.enrolledAccount();Keluar atau hapus secara selektif
Bagian berjudul “Keluar atau hapus secara selektif”await IntuneMAM.logoutOfAccount({ accountId: 'AAD_OBJECT_ID' });await IntuneMAM.deRegisterAndUnenrollAccount({ accountId: 'AAD_OBJECT_ID' });Ringkasan API
Bagian berjudul “Ringkasan API”acquireToken(options): Mulai masuk Microsoft dan kembalikan token beserta metadata akun.acquireTokenSilent(options): Baca token yang di-cache untuk akun yang sudah ada.registerAndEnrollAccount(options): Daftarkan akun MSAL ke Intune dan picu enrollment.loginAndEnrollAccount(): Biarkan Intune menggerakkan alur login dan enrollment.appConfig(user): Baca nilai konfigurasi aplikasi Intune untuk akun tersebut.getPolicy(user): Baca kebijakan perlindungan aplikasi Intune saat ini untuk akun tersebut.groupName(user): Baca nilai umumGroupNamehelper konfigurasi jika ada.sdkVersion(): Periksa versi Intune dan MSAL yang dibundel.
Catatan Platform
Bagian berjudul “Catatan Platform”- Web tidak didukung.
- iOS dan Android keduanya memerlukan konfigurasi proyek native di luar
cap sync. - Registrasi Azure, penugasan kebijakan Intune, redirect URIs, dan entitlements tetap bersifat spesifik aplikasi.
Lanjutkan dari Getting Started
Bagian berjudul “Lanjutkan dari Getting Started”Jika Anda menggunakan Panduan Memulai untuk merencanakan migrasi dan operasional enterprise, hubungkan dengan Menggunakan @capgo/capacitor-intune untuk kapabilitas native saat menggunakan @capgo/capacitor-intune, Capgo Enterprise untuk workflow produk di Capgo Enterprise, Alternatif Plugin Ionic Enterprise untuk workflow produk di Alternatif Plugin Ionic Enterprise, Alternatif Capgo untuk alur kerja produk di Capgo Alternatives, dan Konsultasi Capgo untuk alur kerja produk di Capgo Consulting.