Tips, recommendations, and best practices for using the Gately SDK effectively and securely.

Security Best Practices

Project Configuration

Authentication Security

Performance Optimization

SDK Initialization

Caching and State Management

User Experience

Loading States

Error Handling

Accessibility

Development Workflow

Testing

Debugging

Production Deployment

Environment Configuration

Monitoring

Common Pitfalls

Avoid These Mistakes

Don’t store sensitive data in localStorage
// Bad: Storing sensitive data
localStorage.setItem('user_token', session.access_token)

// Good: Let the SDK handle token storage
const session = gately.getSession()
Don’t ignore error handling
// Bad: No error handling
await gately.login(email, password)

// Good: Proper error handling
try {
  await gately.login(email, password)
} catch (error) {
  handleAuthError(error)
}
Don’t create multiple SDK instances
// Bad: Multiple instances
function Component1() {
  const gately = new GatelyBrowserClient('project-id')
  // ...
}

// Good: Shared instance
const gately = new GatelyBrowserClient('project-id')
function Component1() {
  // Use shared instance
}

Next Steps