Skip to main content
Glama
test-auth-with-api-v1.cjs3 kB
#!/usr/bin/env node /** * Test authentication using /api/v1 prefix path */ const axios = require('axios'); const USERNAME = 'david+saola@umbrellacost.com'; const PASSWORD = 'Dsamsung1!'; async function testAuth() { console.log('🔐 Testing Umbrella API Authentication with /api/v1 prefix'); console.log('Username:', USERNAME); console.log('Password:', '*'.repeat(PASSWORD.length)); console.log('='.repeat(60)); try { console.log('\n1️⃣ Testing with /api/v1/authentication/token/generate...'); const response = await axios.post( 'https://api.umbrellacost.io/api/v1/authentication/token/generate', { username: USERNAME, password: PASSWORD }, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, timeout: 30000 } ); console.log('\n✅ Authentication Successful!'); console.log('Status:', response.status); console.log('Response Headers:', JSON.stringify(response.headers, null, 2)); console.log('Response Data:', JSON.stringify(response.data, null, 2)); if (response.data.Authorization) { console.log('\n🎯 JWT Token received:', response.data.Authorization.substring(0, 50) + '...'); } if (response.data.apikey) { console.log('🔑 API Key received:', response.data.apikey); } // Test getting accounts with the auth if (response.data.Authorization && response.data.apikey) { console.log('\n2️⃣ Testing /api/v1/user-management/accounts with auth...'); const accountsResponse = await axios.get( 'https://api.umbrellacost.io/api/v1/user-management/accounts', { headers: { 'Authorization': response.data.Authorization, 'apikey': response.data.apikey, 'Content-Type': 'application/json', 'Accept': 'application/json' }, timeout: 30000 } ); console.log('\n✅ Accounts Retrieved!'); console.log('Status:', accountsResponse.status); console.log('Accounts:', JSON.stringify(accountsResponse.data, null, 2)); } return response.data; } catch (error) { console.error('\n❌ Authentication Failed'); if (error.response) { console.error('Status:', error.response.status); console.error('Status Text:', error.response.statusText); console.error('Response Data:', JSON.stringify(error.response.data, null, 2)); console.error('Response Headers:', JSON.stringify(error.response.headers, null, 2)); } else if (error.request) { console.error('No response received:', error.message); } else { console.error('Request error:', error.message); } throw error; } } async function main() { try { await testAuth(); console.log('\n✅ All tests passed!'); } catch (error) { console.error('\n❌ Test failed:', error.message); process.exit(1); } } main();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daviddraiumbrella/invoice-monitoring'

If you have feedback or need assistance with the MCP directory API, please join our Discord server