---
title: iOS
description: Integrasikan Human Token Journey ke dalam aplikasi iOS Anda menggunakan ASWebAuthenticationSession — native, aman, dan tanpa WebView.
canonical: https://developer.unico.io/id/human-token/integrations/app/ios
locale: id
generated_by: markdown-export
---

- [/id/](/id/)
- [Integrasi](/id/human-token/integrations)
- Aplikasi
- iOS

**Di halaman iniiOSIntegrasikan Human Token Journey ke dalam aplikasi iOS Anda menggunakan ASWebAuthenticationSession.

`ASWebAuthenticationSession` meluncurkan Human Token Journey di browser yang dikelola sistem. Saat perjalanan selesai, sesi kembali ke aplikasi Anda melalui skema URL yang terdaftar.
### Prasyarat​

iOS 13 atau lebih baru
Xcode 14+
Framework `AuthenticationServices` (bawaan)
Skema URL unik untuk aplikasi Anda (misalnya `myapp`)

### Langkah 1: Tentukan skema URL Anda​

Pilih skema unik (misalnya `myapp`). Ini digunakan sebagai `callbackUri` saat membuat proses:
```
callbackUri: myapp://callback
```

### Langkah 2: Buat presentation context provider​

```
import AuthenticationServicesimport UIKitclass UnicoAuthenticationController: NSObject, ASWebAuthenticationPresentationContextProviding {    func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {        guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,              let window = windowScene.windows.first else {            return ASPresentationAnchor()        }        return window    }}
```

### Langkah 3: Buat session manager​

```
import AuthenticationServicesclass AuthenticationSessionManager {    static let shared = AuthenticationSessionManager()    private var session: ASWebAuthenticationSession?    private let contextProvider = UnicoAuthenticationController()    func start(url: URL, completion: @escaping (String?) -> Void) {        let newSession = ASWebAuthenticationSession(            url: url,            callbackURLScheme: "myapp"        ) { callbackURL, error in            self.session = nil            if let callbackURL = callbackURL {                let components = URLComponents(url: callbackURL, resolvingAgainstBaseURL: false)                let processId = components?.queryItems?.first(where: { $0.name == "id" })?.value                completion(processId)            } else {                completion(nil)            }        }        newSession.presentationContextProvider = contextProvider        newSession.prefersEphemeralWebBrowserSession = true        newSession.start()        session = newSession    }}
```

### Langkah 4: Mulai perjalanan​

```
guard let url = URL(string: processLink) else { return }AuthenticationSessionManager.shared.start(url: url) { processId in    if let processId = processId {        // Journey completed — send processId to your backend via Get Process    } else {        // User canceled the session    }}
```

informasiParameter `callbackURLScheme` hanya menerima nama skema (`myapp`), tanpa `://`.
### Ringkasan file​

FileTujuan`UnicoAuthenticationController.swift`Presentation context providerSession manager (view atau service Anda)Siklus hidup `ASWebAuthenticationSession`Terakhir diperbarui pada 21 Okt 2026**