Langsung ke konten

Panduan Memulai

GitHub

Anda bisa menggunakan AI-Assisted Setup kami untuk menginstal plugin ini. Tambahkan skill Capgo ke tool AI Anda dengan command berikut:

Jendela terminal
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Lalu 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:

Jendela terminal
bun add @capgo/capacitor-intune
bunx cap sync
import { IntuneMAM } from '@capgo/capacitor-intune';
import { Persona } from '@capgo/capacitor-persona';
await Persona.startInquiry({});
  • Listener: hapus handle saat screen unmount.
  • Sinkronisasi Native: jalankan bunx cap sync setelah upgrade plugin.
  • Sumber kebenaran tunggal: percayai src/definitions.ts di repo GitHub.

Tampilkan alur sign-in Microsoft dan kembalikan access token beserta metadata akun.

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.acquireToken({ scopes: ['openid'] });
// The result holds sensitive values: use it without logging it.

Ambil token dari cache MSAL untuk user yang sebelumnya sudah sign-in.

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.

Daftarkan akun yang sudah diautentikasi sebelumnya ke Intune dan mulai enrollment.

import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.registerAndEnrollAccount({ accountId: 'account-id-123' });

Minta Intune mengautentikasi dan mendaftarkan user tanpa meminta app token terlebih dahulu.

import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.loginAndEnrollAccount();

Kembalikan akun Intune yang saat ini terdaftar, jika ada.

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.enrolledAccount();
console.log(result);

Hapus pendaftaran akun dari Intune dan picu selective wipe jika berlaku.

import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.deRegisterAndUnenrollAccount({ accountId: 'account-id-123' });

Keluarkan user dari MSAL tanpa membatalkan enrollment akun Intune.

import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.logoutOfAccount({ accountId: 'account-id-123' });

Ambil konfigurasi aplikasi Intune jarak jauh untuk akun yang dikelola.

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.appConfig({ accountId: 'account-id-123' });
console.log(result);

Ambil kebijakan perlindungan aplikasi Intune yang berlaku saat ini untuk akun terkelola.

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.getPolicy({ accountId: 'account-id-123' });
console.log(result);

Helper praktis yang mengambil GroupName nilai konfigurasi aplikasi jika tersedia.

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.groupName({ accountId: 'account-id-123' });
console.log(result);

Mengembalikan versi native Intune dan MSAL SDK yang disertakan dalam plugin ini.

import { IntuneMAM } from '@capgo/capacitor-intune';
const result = await IntuneMAM.sdkVersion();
console.log(result);

Tampilkan UI diagnostik native Intune.

import { IntuneMAM } from '@capgo/capacitor-intune';
await IntuneMAM.displayDiagnosticConsole();

Opsi akuisisi token interaktif.

export interface AcquireTokenOptions {
/**
* Scopes to request, for example `https://graph.microsoft.com/.default`.
*/
scopes: string[];
/**
* When true, always show the Microsoft account picker or sign-in UI.
*
* @default false
*/
forcePrompt?: boolean;
/**
* Optional login hint for the interactive sign-in flow.
*/
loginHint?: string;
}
export interface IntuneMAMAcquireToken {
accountId: string;
accessToken: string;
accountIdentifier: string;
idToken?: string;
username?: string;
tenantId?: string;
authority?: string;
}

Opsi akuisisi token senyap.

export interface AcquireTokenSilentOptions {
/**
* Scopes to request, for example `https://graph.microsoft.com/.default`.
*/
scopes: string[];
/**
* Microsoft Entra object ID returned by `acquireToken` or `enrolledAccount`.
*/
accountId: string;
/**
* When true, bypass the cached access token and request a fresh one.
*
* @default false
*/
forceRefresh?: boolean;
}
export interface RegisterAndEnrollAccountOptions {
/**
* Microsoft Entra object ID returned by `acquireToken`.
*/
accountId: string;
}
export interface IntuneMAMUser {
accountId: string;
accountIdentifier?: string;
username?: string;
tenantId?: string;
authority?: string;
}
export interface IntuneMAMAppConfig {
accountId: string;
fullData: Record<string, string>[];
values: Record<string, string>;
conflicts: string[];
}
export interface IntuneMAMPolicy {
accountId: string;
isPinRequired?: boolean;
isManagedBrowserRequired?: boolean;
isScreenCaptureAllowed?: boolean;
isContactSyncAllowed?: boolean;
isAppSharingAllowed?: boolean;
isFileEncryptionRequired?: boolean;
notificationPolicy?: string;
}
export interface IntuneMAMGroupName {
accountId: string;
groupName?: string;
}
export interface IntuneMAMVersionInfo {
platform: 'ios' | 'android';
intuneSdkVersion: string;
msalVersion?: string;
}
export interface IntuneMAMChangeEvent {
accountId?: string;
}

Halaman ini dibuat dari plugin src/definitions.ts. Jalankan ulang sync saat API publik berubah di upstream.

Jika Anda menggunakan Panduan Memulai untuk merencanakan operasi dashboard dan API, hubungkan dengan Menggunakan @capgo/capacitor-intune untuk kapabilitas native saat menggunakan @capgo/capacitor-intune, Ringkasan API untuk detail implementasi di API Overview, Pendahuluan untuk detail implementasi di Introduction, Kunci API untuk detail implementasi di API Keys, dan Perangkat untuk detail implementasi di Devices.