sign In Or Create Member
Attempts to authenticate a member using their externalUserId.
This flow is intended for organization accounts that do not use eligibility files. Instead, members are identified and authenticated directly by a tenant-unique identifier.
Legacy / backend-only. This method calls
/api/v1/auth/tokendirectly and therefore requires the Client Secret to be present in AFCoreConfig. That is acceptable for backend-only services, local development, and legacy tenants, but not for production mobile apps (a bundled secret is extractable). For the secure mobile pattern, have your backend perform the token exchange and adopt the result with authenticateWithTokens instead.
Return
true if authentication succeeded; false if the member could not be found.
Parameters
A tenant-unique identifier string.
Throws
on network errors or unexpected responses.
Android (Kotlin) — auto-login after member creation
lifecycleScope.launch {
val ok = AFCore.authentication().loginWithUniqueId(uniqueId = "EMP001")
if (ok) navigateToHome() else showError("Member not found")
}iOS (Swift) — auto-login after member creation
Task {
do {
let ok = try await AFCore.shared.authentication().signInOrCreateMember(externalUserId: "EMP001")
if ok { navigateToHome() } else { showError("Member not found") }
} catch {
showError("Sign in failed: \\(error.localizedDescription)")
}
}