Lompat ke konten

Mulai

  1. Pasang paket

    Jendela terminal
    bun add @capgo/capacitor-intune
  2. Sinkronkan proyek native

    Jendela terminal
    bunx cap sync
  3. Selesaikan pengaturan native Intune Ikuti panduan khusus Pengaturan iOS dan Pengaturan Android halaman. Intune masih memerlukan konfigurasi aplikasi-host native untuk autentikasi brokered, URI redirect, manifest, hak istimewa, dan konfigurasi MSAL.

  • Capacitor 8+
  • Android dengan Intune Android SDK 12.0.3
  • iOS with Intune iOS SDK 21.5.1
  • Dokumen Intune Ionic saat ini mengacu pada batas waktu 19 Januari 2026 untuk aplikasi yang dibangun dengan Xcode 26, memerlukan Intune iOS __CAPGO_KEEP_0__ 17.0+

Ionic’s Intune docs currently call out a January 19, 2026 cutoff for apps built with Xcode 26, requiring Intune iOS SDK 21.1.0+Penggunaan Dasar 21.5.1.

Judul bagian “Penggunaan Dasar”

Salin ke clipboard
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 });
const auth = await IntuneMAM.acquireToken({
scopes: ['https://graph.microsoft.com/.default'],
});
await IntuneMAM.registerAndEnrollAccount({
accountId: auth.accountId,
});
const token = await IntuneMAM.acquireTokenSilent({
accountId: 'AAD_OBJECT_ID',
scopes: ['https://graph.microsoft.com/.default'],
forceRefresh: true,
});
const user = await IntuneMAM.enrolledAccount();
await IntuneMAM.logoutOfAccount({ accountId: 'AAD_OBJECT_ID' });
await IntuneMAM.deRegisterAndUnenrollAccount({ accountId: 'AAD_OBJECT_ID' });
  • acquireToken(options): Mulai masuk ke Microsoft dan kembalikan token serta metadata akun.
  • acquireTokenSilent(options): Baca token yang disimpan untuk akun yang sudah ada.
  • registerAndEnrollAccount(options): Daftarkan akun MSAL dengan Intune dan trigger pendaftaran.
  • loginAndEnrollAccount(): Biarkan Intune mengemudikan alur masuk dan pendaftaran.
  • appConfig(user): Baca nilai konfigurasi aplikasi Intune untuk akun.
  • getPolicy(user): Baca kebijakan perlindungan aplikasi Intune saat ini untuk akun.
  • groupName(user): Baca nilai helper konfigurasi umum ketika ada. GroupName : Baca nilai helper konfigurasi umum ketika ada.
  • sdkVersion(): Inspect versi Intune dan MSAL yang dibundel.
  • Web tidak didukung.
  • iOS dan Android sama-sama memerlukan pengaturan proyek native yang lebih lanjut dari cap sync.
  • Pendaftaran Azure Anda, pengaturan kebijakan Intune, URI pengalihan, dan hak istimewa tetap spesifik aplikasi.