authenticate

abstract suspend fun authenticate(hostToken: String): CgsResult<Unit>

Exchanges one of your own tokens for an SDK session, unlocking the content APIs.

Call it after the user has signed in on your side. On success state becomes AuthState.Identified.User; on failure it is left as it was and the error says why — a rejected token is CgsError.Auth.Unauthorized, an unreachable server is a CgsError.Network, and only the latter is worth retrying.

The resulting session is persisted and refreshed automatically, so this belongs in your sign-in flow, not in Application.onCreate.

Return

CgsResult.Success once the session is open, CgsResult.Failure otherwise.

Parameters

hostToken

the token your backend issues for the signed-in user.