Add Phone Authentication to Your Node.js Backend
Set up the backend API endpoints that your frontend SDK calls using the Glide Node.js SDK.
Install the SDK
Install the Glide Node.js SDK.
Initialize the Client
Create a GlideClient with your client credentials.
Store your credentials in environment variables - never commit them to code.
Create API Endpoints
Create four endpoints for the frontend SDK:
/prepare- Initializes the auth session/report-invocation- Reports prompt was shown (fire-and-forget)/process- Routes toverifyPhoneNumber()orgetPhoneNumber()/complete- Validates device binding codes (Link protocol only)
API Methods Reference
The SDK provides four main methods:
prepare()- Initialize authentication sessionreportInvocation()- Report prompt was shown (fire-and-forget)verifyPhoneNumber()- Confirm user owns a phone numbergetPhoneNumber()- Retrieve phone from device
Error Handling
Handle specific error codes from the SDK.
Anti-Fraud Signals
Both verifyPhoneNumber() and getPhoneNumber() responses include SIM swap and device swap (IMEI change) fraud detection signals.
Each signal includes risk_level, age_band, carrier_name, and checked_at.
Device Binding (Link Protocol)
For Link protocol sessions (e.g., Verizon via App Clips), device binding is mandatory. Your backend must generate a cryptographic code, hash it, and send 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 could phish a victim into authenticating on the attacker's session.
Next Steps
Your backend is ready! Now set up the frontend.
npm install @glideidentity/glide-be-sdk-nodeRead-only