A SwiftUI iOS/iPadOS app for chatting with Microsoft Work IQ using the A2A v1.0 (Agent-to-Agent) protocol.
Targets the Work IQ Gateway (https://workiq.svc.cloud.microsoft/a2a/) by default; override via the Endpoint key in Configuration.plist.
- Microsoft 365 sign-in via MSAL (silent + interactive)
- A2A v1.0 protocol over JSON-RPC transport
- Multi-turn conversations with persistent context
- Markdown rendering in agent responses
- Automatic token refresh between turns
- Xcode 26+ (Swift 6.0)
- iOS/iPadOS 26+ device or simulator
- A Microsoft 365 Copilot license on your test user
- An Entra app registration with the
WorkIQAgent.Askdelegated permission and the iOS redirect URI (see Setup below)
Admin setup note: For multi-language testing (this sample + the .NET samples sharing one app registration), use the unified
../../ADMIN_SETUP.mdandscripts/admin-setup.{sh,ps1}at the repo root. The script in this folder (setup-app-registration.{sh,ps1}) is iOS-specific — it adds the iOS redirect URI (msauth.app.blueglass.A2A-Chat://auth) needed by MSAL on iOS, and generatesConfiguration.plist. Run it after the unified script (or instead of, if you only need the iOS app).
The included scripts automate app registration. Pick whichever matches your environment:
# Requires Azure CLI
# macOS: brew install azure-cli
# Linux: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux
az login
./setup-app-registration.sh# Requires Azure CLI
# Install: winget install Microsoft.AzureCLI
az login
.\setup-app-registration.ps1Both scripts will:
- Create an app registration named A2A Chat
- Configure the iOS redirect URI (
msauth.app.blueglass.A2A-Chat://auth) - Add the
WorkIQAgent.Askdelegated permission - Grant admin consent
- Generate
A2A Chat/Configuration.plistwith your App ID and the Work IQ Gateway endpoint
If you already have an app registration:
- Copy
A2A Chat/Configuration.example.plisttoA2A Chat/Configuration.plist - Replace
YOUR_APP_CLIENT_IDwith your Entra App (client) ID - (Optional) Override the
Endpointvalue if you're not using the default gateway URL
Configuration.plist is git-ignored so your client ID stays out of source control.
- Open
A2A Chat.xcodeprojin Xcode. - Swift packages (MSAL, A2AClient) resolve automatically.
- Select an iOS simulator or device and run.
| Key | Required | Default | Notes |
|---|---|---|---|
ClientId |
yes | — | Entra App (client) ID |
RedirectUri |
no | MSAL default | iOS redirect URI registered on the app |
TenantId |
no | common |
Tenant ID or domain |
Scopes |
no | [api://workiq.svc.cloud.microsoft/.default] |
OAuth scopes |
Endpoint |
no | https://workiq.svc.cloud.microsoft/a2a/ |
A2A endpoint |
A2A Chat/
├── A2A_ChatApp.swift # App entry point, MSAL callback handling
├── Models/
│ └── ChatMessage.swift # Chat message data model
├── Services/
│ ├── AuthService.swift # MSAL auth + AppConfiguration loader
│ └── A2AService.swift # A2A client wrapper
└── Views/
├── ContentView.swift # Routes between Welcome and Chat
├── WelcomeView.swift # Sign-in screen
├── ChatView.swift # Chat interface
└── MessageBubbleView.swift # Message bubble with markdown
| Package | Source | Purpose |
|---|---|---|
| MSAL | AzureAD | Microsoft 365 authentication |
| A2AClient (1.0.14+) | tolgaki | A2A v1.0 protocol client |