Add Phone Authentication to Your iOS App
Use the native Glide iOS SDK with your existing backend proxy. Glide selects the auth strategy server-side and returns it in the prepare response — your code just consumes the result and forwards the Universal Link callback when one arrives.
Install the SDK
Add GlidePhoneAuth with Swift Package Manager or CocoaPods. The SDK ships as a precompiled binary (XCFramework) and targets the Magical Auth API v2.
Requirements: iOS 15.0+, Swift 5.9+.
For air-gapped CI, contact your Glide integration lead for a vendor-hosted XCFramework with a SHA-256 sidecar.
Initialize the PhoneAuthClient
Point endpoints at routes on your backend. The SDK never calls Glide directly — your server proxies the prepare and process calls so OAuth credentials never ship in the app.
reportInvocation is optional (analytics); omit it if you don't expose that route.
Configure Universal Links + forward the callback
Glide's Link strategy completes through a Universal Link round-trip (device binding is backed by the Secure Enclave). Enable the Associated Domains capability for your app and host an apple-app-site-association (AASA) file — your Glide integration lead provides the domain.
When the callback URL arrives, forward it to client.handleDeepLink(url). In SwiftUI, attach .onOpenURL at your app root.
Authenticate
The high-level authenticate() API runs the full prepare → invoke prompt → process sequence in a single async call and returns a typed result.
If you need step-by-step control (e.g. to show your own UI between phases), use the granular API: prepare() → invokeSecurePrompt() → getPhoneNumber() / verifyPhoneNumber(). The SDK dispatches on the strategy returned by prepare — you don't branch on it yourself.
Test the integration
Run the flow on a real device with a SIM (the Link strategy needs the carrier round-trip; the Secure Enclave is unavailable on the Simulator). Confirm the Universal Link returns to your app and handleDeepLink resumes the in-flight call.
Expose prepare, process, and optionally report-invocation on your backend using the Glide backend SDK (Node.js, Go, or Java). See the Node.js or Java quickstart for a full backend example.
// Swift Package Manager — add the package in Xcode
// (File ▸ Add Package Dependencies…) or in Package.swift:
dependencies: [
.package(
url: "https://github.com/GlideIdentity/glide-fe-sdk-ios.git",
from: "1.0.0"
)
]
// CocoaPods — in your Podfile:
// pod 'GlidePhoneAuth'Read-only