toJson

abstract fun toJson(): String

Save current state to a JSON string.

This method serializes the current account state into a JSON string, which the application can use to persist the user's signed-in state across restarts. The application should call this method and update its persisted state after any potentially-state-changing operation.

⚠️ Warning: the serialized state may contain encryption keys and access tokens that let anyone holding them access the user's data in Firefox Sync and/or other FxA services. Applications should take care to store the resulting data in a secure fashion, as appropriate for their target platform.