---
title: iOS
description: Integre a jornada Human Token no seu aplicativo iOS usando ASWebAuthenticationSession — nativo, seguro e sem necessidade de WebView.
canonical: https://developer.unico.io/pt-BR/human-token/integrations/app/ios
locale: pt-BR
generated_by: markdown-export
---

- [/pt-BR/](/pt-BR/)
- [Integrações](/pt-BR/human-token/integrations)
- App
- iOS

**Nesta páginaiOSIntegre a jornada Human Token no seu aplicativo iOS usando ASWebAuthenticationSession.

`ASWebAuthenticationSession` inicia a jornada Human Token em um navegador gerenciado pelo sistema. Quando a jornada termina, a sessão retorna ao seu aplicativo pelo esquema de URL registrado.
### Pré-requisitos​

iOS 13 ou posterior
Xcode 14+
Framework `AuthenticationServices` (integrado)
Um esquema de URL exclusivo para o seu aplicativo (ex.: `myapp`)

### Passo 1: Definir o esquema de URL​

Escolha um esquema exclusivo (ex.: `myapp`). Ele é usado como `callbackUri` ao criar o processo:
```
callbackUri: myapp://callback
```

### Passo 2: Criar o provedor de contexto de apresentação​

```
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    }}
```

### Passo 3: Criar o gerenciador de sessão​

```
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    }}
```

### Passo 4: Iniciar a jornada​

```
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    }}
```

informaçãoO parâmetro `callbackURLScheme` aceita apenas o nome do esquema (`myapp`), sem `://`.
### Resumo dos arquivos​

ArquivoFinalidade`UnicoAuthenticationController.swift`Provedor de contexto de apresentaçãoGerenciador de sessão (sua view ou serviço)Ciclo de vida do `ASWebAuthenticationSession`Última atualização em 21 de out. de 2026**