Authentication
BasaltCRM supports multiple authentication methods for different use cases — from user login to service-to-service integration.
NextAuth Session
Browser-based SSO for end users via Google, GitHub, or Azure AD.
OAuth 2.0 + PKCE
Secure authorization code flow for third-party integrations.
x402 Payment Auth
402 Protocol for Agent Commerce with USDC on Base network.
NextAuth.js — User Authentication
BasaltCRM uses NextAuth.js for all user-facing authentication. Users sign in via OAuth providers (Google, GitHub, Azure AD), and sessions are managed server-side with JWT encryption.
Supported Providers
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRETOAuth 2.0 via Google Workspace or personal accounts.
GITHUB_ID / GITHUB_SECRETOAuth App for developer-friendly login.
AZURE_AD_CLIENT_ID / AZURE_AD_TENANT_IDEnterprise SSO for Microsoft-centric organizations.
Session Structure
OAuth 2.0 + PKCE — Service Integration
For service-to-service integrations (e.g., BasaltECHO connecting to your CRM), BasaltCRM implements the Authorization Code + PKCE flow. This is the recommended method for third-party applications.
Authorization Request
Redirect the user to the BasaltCRM authorization endpoint.
User Consent
BasaltCRM presents a branded consent screen. The user approves access, and the browser redirects back to your redirect_uri with an authorization code.
Token Exchange
Exchange the authorization code for access and refresh tokens.
Token Response
Receive your access token and use it to call BasaltCRM APIs.
Available Scopes
| Scope | Description |
|---|---|
softphone:control | Control BasaltECHO voice sessions — start, stop, push prompts. |
outreach:write | Create and manage outreach sequences and campaigns. |
leads:read | Read-only access to leads, contacts, and pipeline data. |
leads:write | Create, update, and delete lead records. |
accounts:read | Read-only access to account records. |
projects:read | Access project boards and task data. |
x402 Protocol — Agent Commerce
The Agent Commerce API uses the HTTP 402 Payment Required protocol. Clients receive a payment challenge, settle on-chain with USDC on Base, then pass the payment proof in the Authorization: Payment <proof> header.
Security Best Practices
- • Never expose API keys or OAuth client secrets in client-side code.
- • Always use PKCE (
S256) for OAuth flows — plain code challenges are rejected. - • Verify webhook signatures using HMAC-SHA256 in production environments.
- • Rotate tokens periodically and use short-lived access tokens (1h default).
- • Use
NEXTAUTH_SECRETwith 256+ bits of entropy for JWT encryption.