migrate
Migrates the token held by a legacy SessionClient into a new Credential, persisting it to the CredentialDataSource, and clears the legacy SessionClient.
On success/previously-migrated, look the stored credential up with Credential.with(result.tokenId) and optionally make it the default via Credential.default = ... / Credential.setDefaultAsync(...).
Return
a Result: Result.SuccessfullyMigrated (new credential created), Result.PreviouslyMigrated (migration already ran previously), Result.MissingLegacyToken (the SessionClient had no token), or Result.Error (an exception occurred — inspect exception). This function never throws for these cases; it is safe to call from any dispatcher (it switches to Dispatchers.IO internally).
Parameters
used for storing the status of previous migrations in Shared Preferences.
a configured session client with the stored tokens from a previous authentication where the token will be migrated from.