Use this file to discover all available pages before exploring further.
This guide walks you through implementing authentication with Rise using the official SDK. The Rise SDK handles all the complexity of SIWE and JWT authentication automatically.
const { RiseApiClient } = require('@riseworks/sdk');require('dotenv').config();// Initialize with Rise ID and private key (recommended)const client = new RiseApiClient({ environment: 'prod', riseIdAuth: { riseId: process.env.RISE_ID, privateKey: process.env.PRIVATE_KEY }});// Alternative: Initialize with JWT tokenconst jwtClient = new RiseApiClient({ environment: 'prod', jwtToken: process.env.JWT_TOKEN});async function main() { try { // SDK automatically handles authentication console.log('Authenticating with Rise...'); // Get user information const user = await client.me.get(); console.log('Authenticated as:', user.data.name); // Get user's teams const teams = await client.me.teams(); console.log('Teams:', teams.data); // Get company information const company = await client.company.get(); console.log('Company:', company.data.name); } catch (error) { console.error('Authentication error:', error.message); }}// Run the exampleif (require.main === module) { main();}
Use a pre-generated JWT token for direct API access:
const { RiseApiClient } = require('@riseworks/sdk');const client = new RiseApiClient({ environment: 'prod', jwtToken: process.env.JWT_TOKEN});// SDK automatically includes JWT in all requestsconst user = await client.me.get();
Use cases:
Existing JWT tokens - When you already have a valid JWT token
Read-only operations - For applications that only need to read data
Simple integrations - When you don’t need sensitive write operations
The SDK provides comprehensive error handling with descriptive error messages:
try { const user = await client.me.get(); console.log('Success:', user.data);} catch (error) { console.error('Authentication error:', error.message); // Handle specific error types based on message content if (error.message.includes('Failed to generate JWT token')) { console.error('JWT generation failed. Check your Rise ID and private key.'); } else if (error.message.includes('401')) { console.error('Authentication failed. The SDK will automatically retry.'); } else if (error.message.includes('403')) { console.error('Insufficient permissions for this operation.'); } else { console.error('API Error:', error.message); }}
// Use secondary wallets for API operations// Never use wallets with significant funds for API authenticationconst client = new RiseApiClient({ environment: 'prod', riseIdAuth: { riseId: process.env.RISE_ID, privateKey: process.env.SECONDARY_WALLET_PRIVATE_KEY // Use secondary wallet }});