LogoDocumentación
Extension15 min read

Extension Authentication

Secure your Extension connections with proper authentication

Extension Team

Extension Team

Última actualización:2/22/2024

Extension Authentication

Secure authentication is crucial for protecting your trading data and operations. This guide covers authentication methods for Neura Extensions.

Authentication Methods

API Keys

The simplest method for server-to-server communication.

const extension = new NeuraExtension({
  apiKey: process.env.NEURA_API_KEY
});

OAuth 2.0

For applications that need to act on behalf of users.

JWT Tokens

For stateless authentication with expiration.

Generating API Keys

  1. Navigate to Settings > API Keys
  2. Click "Generate New Key"
  3. Set permissions and restrictions
  4. Store the key securely

Security Best Practices

Environment Variables

Never hardcode API keys in your source code.

# .env file
NEURA_API_KEY=your-secret-key

IP Whitelisting

Restrict API access to known IP addresses.

Key Rotation

Regularly rotate your API keys for enhanced security.

Error Handling

try {
  const response = await extension.authenticate();
} catch (error) {
  if (error.code === 'INVALID_KEY') {
    console.error('Invalid API key');
  } else if (error.code === 'RATE_LIMITED') {
    console.error('Too many requests');
  }
}

Troubleshooting

Common authentication issues:

  • Expired API keys
  • Incorrect permissions
  • IP not whitelisted
  • Rate limit exceeded