Add Phone Authentication to Your Android App
Use the native Glide Android SDK with your existing backend proxy. The SDK uses Android's Digital Credentials API for the TS43 strategy. Glide picks the strategy server-side based on the device and carrier — your code just consumes the result.
Add the SDK dependency
The SDK ships as a single Maven Central artifact. R8 strips unused code at the consuming app's release build, so you only ship what you actually reference.
Requirements: minSdk = 23 (Android 6+). TS43 strategy uses the Android Digital Credentials API (Android 9+ / API 28, Google Play Services 24.0+, registered carrier credential provider). compileSdk 35 is required by the androidx.credentials library.
For air-gapped CI, contact your Glide integration lead for a vendor-hosted AAR with a SHA-256 sidecar.
Create a Client
Point baseUrl at your backend. The SDK never calls Glide directly — your server proxies the /prepare and /process calls so OAuth credentials never ship in the app.
Call setActivityContext(this) before any auth call from an Activity — the SDK needs it to invoke the on-device Digital Credentials prompt.
Run the auth flow
The high-level authenticate() API runs the full prepare → invoke prompt → report → process sequence in a single suspending 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 shown in the SDK README.
Handle errors
All SDK calls throw subclasses of AuthError. Match the typed subclass to switch UX — most cases fall into "user cancelled", "carrier ineligible", or "network failure".
The full error code reference lives in MagicalAuthErrorCode; partner-actionable codes are documented at Error handling.
Backend proxy routes
Release SDK resources
The client owns an HTTP client + internal coroutine scope. Call close() when you're done with it (e.g. in onCleared() of a ViewModel), or use Kotlin's use block since Client implements AutoCloseable.
dependencies {
implementation("com.glideidentity:glide-fe-sdk-android:1.0.0")
}Read-only