LegacyTokenMigration

A helper class to migrate tokens from the Legacy OIDC SDK to Auth Foundations Credential.

migrate is idempotent — it records completion in private SharedPreferences and returns Result.PreviouslyMigrated on subsequent calls, so it is safe to invoke on every app start.

See migrate.md for more information.

Types

Link copied to clipboard
sealed class Result

The exhaustive set of outcomes from LegacyTokenMigration.migrate. Branch on it with an exhaustive when to handle success, prior migration, a missing legacy token, and errors.

Functions

Link copied to clipboard
suspend fun migrate(context: Context, sessionClient: SessionClient): LegacyTokenMigration.Result

Migrates the token held by a legacy SessionClient into a new Credential, persisting it to the CredentialDataSource, and clears the legacy SessionClient.