Skip to main content

Add Phone Authentication to Your Go Backend

Set up carrier-grade phone authentication in your Go API using the Glide Go SDK.

1

Install the SDK

Install the Glide Go SDK.

2

Initialize the Client

Create a GlideClient with your client credentials and optional settings.

3

Create API Handlers

Create handlers for the frontend SDK endpoints:

  • Prepare - Initializes the auth session
  • ReportInvocation - Reports prompt was shown (fire-and-forget)
  • Process - Routes to VerifyPhoneNumber() or GetPhoneNumber()
  • Complete - Validates device binding codes (Link protocol only)
4

Error Handling

Handle SDK-specific errors using the glide.MagicalAuthError type.

5

Set Up Routes

Register your handlers and start the server.

6

Anti-Fraud Signals

Both VerifyPhoneNumber() and GetPhoneNumber() responses include SIM swap and device swap (IMEI change) fraud detection signals.

Each signal includes RiskLevel, AgeBand, CarrierName, and CheckedAt.

7

Device Binding (Link Protocol)

For Link protocol sessions (e.g., Verizon via App Clips), device binding is mandatory. Your backend generates a cryptographic code, hashes it, and sends the hash during Prepare(). After carrier auth, a second code arrives via URL fragment, and your backend validates both codes via Complete().

This prevents session fixation attacks where an attacker tricks a victim into authenticating on the attacker's session.

Read the full Device Binding Security guide →

go get github.com/GlideIdentity/glide-be-sdk-go
Read-only