Authentication
Manages user authentication and session lifecycle.
This interface provides the core functions for user authentication, including signing in with various methods, signing out, and managing the session state. Implementations of this interface are responsible for communicating with the AdvantaHealth backend services and securely storing session information.
Key Operations
Sign in with credentials: Authenticate using a username and password via authenticateWithCredentials.
Sign in or create with external ID: Authenticate or provision a user based on an organization-specific identifier using signInOrCreateMember. This is typically used for systems that do not rely on eligibility files.
Sign out: Terminate the current session and clear all local authentication data with logout.
Usage Notes
All functions are
suspendand must be invoked from a coroutine.Network or server errors are propagated as exceptions (
Throwable) and should be handled by the caller.
Common Scenarios
Initial App Launch: Attempt to refresh an existing session. If it fails, direct the user to the sign-in screen.
User Sign-In: Call authenticateWithCredentials with user-provided credentials. On success, navigate to the main part of the application.
SSO/External ID Flow: Use signInOrCreateMember to authenticate a user with an identifier provided by an external system (e.g., an employee ID).
Functions
Attempts to authenticate a member using their externalUserId.