Serializes the user into the payload expected by the token endpoint.
Map<String, dynamic> toJson() => { 'id': id, if (name != null) 'name': name, if (avatarUrl != null) 'avatarUrl': avatarUrl, };