Skip to content

android: decode password-login payload leniently - #420

Merged
Dvorinka merged 1 commit into
Dvorinka:masterfrom
dxts:fix/android-login-unknown-keys
Nov 9, 2026
Merged

Dvorinka merged 1 commit into
Dvorinka:masterfrom
dxts:fix/android-login-unknown-keys

Conversation

@dxts

@dxts dxts commented Nov 7, 2026

Copy link
Copy Markdown

Problem

Since #414 the password-only login path decodes the LoginResponse out of the JsonElement payload with the strict default Json instance. Any field the DTO does not model fails the whole sign-in; in practice user.created_at does, so password login without 2FA is broken against current servers:

Encountered an unknown key 'created_at'. Use 'ignoreUnknownKeys = true' in 'Json {}' builder to ignore unknown keys.

The 2FA path was unaffected because it goes through the Retrofit converter, which already ignores unknown keys.

Fix

Expose the ApiClient decoder (ignoreUnknownKeys, coerceInputValues) and reuse it in LoginViewModel, so both paths decode the same way.

Testing

Reproduced against a local 4.23.x server (android/dev tooling, separate PR to follow); password login succeeds after the change, 2FA path unchanged.

The non-2FA branch decoded the LoginResponse with the strict default
Json, so any field the DTO does not model (e.g. user.created_at) failed
the sign-in. Reuse the ApiClient decoder, which ignores unknown keys.
@mira-tdvorak

mira-tdvorak Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Mira PR Walkthrough

This PR fixes a password-only login regression on Android caused by strict JSON decoding. The fix exposes the lenient JSON decoder (with ignoreUnknownKeys and coerceInputValues) from ApiClient and reuses it in LoginViewModel, ensuring both password-only and 2FA login paths decode server responses consistently. Previously, unknown fields like user.created_at caused password login to fail while 2FA worked via Retrofit's lenient converter.

Confidence: 5/5   ◉◉◉◉◉   Safe to merge
  • Targeted fix addressing a known regression; minimal changes reusing existing well-tested decoder configuration; both login paths now behave identically.

2 files reviewed


Comment @mira-tdvorak help to get the list of available commands and usage tips.

@Dvorinka Dvorinka closed this Nov 9, 2026
@Dvorinka Dvorinka reopened this Nov 9, 2026
@Dvorinka
Dvorinka merged commit b14fca9 into Dvorinka:master Nov 9, 2026
2 checks passed
@dxts
dxts deleted the fix/android-login-unknown-keys branch November 9, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants