Glide SDK for Node.js - carrier-based phone verification
npm install @glideidentity/glide-be-sdk-nodeGlide SDK for Node.js — carrier-based phone verification.
Documentation: https://docs.glideidentity.com
``bash`
npm install @glideidentity/glide-be-sdk-node
`typescript
import { GlideClient, UseCase } from '@glideidentity/glide-be-sdk-node';
const client = new GlideClient({
clientId: process.env.GLIDE_CLIENT_ID,
clientSecret: process.env.GLIDE_CLIENT_SECRET
});
// Prepare authentication
const response = await client.magicalAuth.prepare({
use_case: UseCase.VERIFY_PHONE_NUMBER,
phone_number: '+14155551234'
});
// Process credential from browser
const result = await client.magicalAuth.verifyPhoneNumber({
session: response.session,
credential: credentialFromBrowser
});
console.log(result.verified); // true
`
`typescript`
const client = new GlideClient({
clientId: 'your-client-id', // Required (or set GLIDE_CLIENT_ID env var)
clientSecret: 'your-secret', // Required (or set GLIDE_CLIENT_SECRET env var)
baseUrl: 'https://api.glideidentity.app', // Optional, defaults to production
logLevel: LogLevel.INFO, // DEBUG | INFO | WARN | ERROR
logFormat: 'text', // 'text' | 'json'
tokenRefreshBuffer: 60, // Seconds before token expiry to refresh (default: 60)
});
Configuration can also be set via environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| GLIDE_CLIENT_ID | — | OAuth2 client ID (required if not set programmatically) |GLIDE_CLIENT_SECRET
| | — | OAuth2 client secret (required if not set programmatically) |GLIDE_API_BASE_URL
| | https://api.glideidentity.app | API endpoint |GLIDE_LOG_LEVEL
| | info | Log level: debug, info, warn, error |
Programmatic settings take precedence over environment variables.
`typescript
import { MagicalAuthError, ErrorCode } from '@glideidentity/glide-be-sdk-node';
try {
await client.magicalAuth.prepare(request);
} catch (error) {
if (error instanceof MagicalAuthError) {
if (error.is(ErrorCode.CARRIER_NOT_ELIGIBLE)) {
// Handle unsupported carrier
}
}
}
`
For types and constants without HTTP client:
`bash``
npm install @glideidentity/glide-be-sdk-node-core
Copyright (c) Glide Identity Inc.