iOS Authentication Overview

The Agentforce iOS SDK provides a comprehensive authentication system that handles secure credential management, session persistence, and user authentication for conversational AI interactions. The system is designed to integrate seamlessly with Salesforce's authentication infrastructure while providing flexibility for custom authentication implementations.

The authentication system is built around the AgentforceClient which serves as the primary entry point for all SDK functionality, including authentication management.

The authentication system follows a secure, multi-step process:

  • User credentials are validated against Salesforce org
  • Authentication tokens are obtained and securely stored
  • Session state is established and maintained
  • Automatic token refresh before expiration
  • Secure session persistence across app launches
  • Session validation and renewal as needed
  • Encrypted storage of authentication tokens
  • Secure transmission of credentials
  • Automatic cleanup on logout or session timeout

Configure the AgentforceClient with your credential provider to establish authenticated sessions.

Implement custom authentication providers that integrate with your existing authentication infrastructure.

  • Token Encryption: All authentication tokens are encrypted at rest
  • Secure Transmission: HTTPS-only communication with Salesforce services
  • Session Timeout: Automatic session expiration and cleanup
  • Credential Validation: Continuous validation of authentication state

The system manages several authentication states:

  • Authenticated: User is successfully authenticated and session is active
  • Token Refresh: Automatic token renewal in progress
  • Unauthenticated: User needs to re-authenticate
  • Session Expired: Session has expired and requires re-authentication

The authentication system provides comprehensive error handling for common scenarios:

  • Invalid Credentials: Clear error messages for authentication failures
  • Network Issues: Graceful handling of connectivity problems
  • Token Expiration: Automatic refresh attempts with fallback to re-authentication
  • Session Conflicts: Resolution of concurrent session issues