|
17 | 17 | // §8 CLOUD PARSING 469– 483 |
18 | 18 | // §9 WIFI SETUP 484– 742 |
19 | 19 | // §10 LITTLEFS 743– 787 |
20 | | -// §11 FIREBASE AUTHENTICATION 788– 966 |
21 | | -// §12 FIRESTORE SCALE HEARTBEAT & SYNC 967– 1894 |
22 | | -// §13 WEBSOCKET 1895– 1931 |
23 | | -// §14 WEIGHT FILTER HELPERS 1932– 1946 |
24 | | -// §15 POST-SEND STATE RESET (shared by all send paths) 1947– 1968 |
25 | | -// §16 SHARED WEIGHT PUSH HANDLER (used by /api/weight and /api/push-weight) 1969– 2041 |
26 | | -// §17 WEB SERVER 2042– 2593 |
27 | | -// §18 CLOUD COMMUNICATION 2594– 2867 |
28 | | -// §19 mDNS 2868– 2905 |
29 | | -// §20 SCALE 2906– 2997 |
30 | | -// §21 RFID 2998– 3376 |
31 | | -// §22 OTA — Over-the-air firmware + filesystem update 3377– 3745 |
32 | | -// §23 SETUP & LOOP 3746– 4079 |
| 20 | +// §11 FIREBASE AUTHENTICATION 788– 973 |
| 21 | +// §12 FIRESTORE SCALE HEARTBEAT & SYNC 974– 1901 |
| 22 | +// §13 WEBSOCKET 1902– 1938 |
| 23 | +// §14 WEIGHT FILTER HELPERS 1939– 1953 |
| 24 | +// §15 POST-SEND STATE RESET (shared by all send paths) 1954– 1975 |
| 25 | +// §16 SHARED WEIGHT PUSH HANDLER (used by /api/weight and /api/push-weight) 1976– 2048 |
| 26 | +// §17 WEB SERVER 2049– 2600 |
| 27 | +// §18 CLOUD COMMUNICATION 2601– 2874 |
| 28 | +// §19 mDNS 2875– 2912 |
| 29 | +// §20 SCALE 2913– 3004 |
| 30 | +// §21 RFID 3005– 3383 |
| 31 | +// §22 OTA — Over-the-air firmware + filesystem update 3384– 3752 |
| 32 | +// §23 SETUP & LOOP 3753– 4086 |
33 | 33 | // |
34 | 34 | // To regenerate this block: ./scripts/update_toc.sh |
35 | 35 | // ─── TOC END ─────────────────────────────────────────────── |
@@ -821,9 +821,16 @@ bool firebaseSignIn() { |
821 | 821 | firebaseAuth = false; |
822 | 822 | return false; |
823 | 823 | } |
824 | | - StaticJsonDocument<768> doc; |
825 | | - if (deserializeJson(doc, resp)) { |
826 | | - Serial.println("[FIREBASE] SignIn JSON parse error"); |
| 824 | + // Firebase JWT response is ~2 KB — use a filter to parse only the 3 fields we need |
| 825 | + // (StaticJsonDocument<768> was too small and caused silent parse failure) |
| 826 | + StaticJsonDocument<64> filter; |
| 827 | + filter["idToken"] = true; |
| 828 | + filter["refreshToken"] = true; |
| 829 | + filter["localId"] = true; |
| 830 | + DynamicJsonDocument doc(1792); |
| 831 | + DeserializationError err = deserializeJson(doc, resp, DeserializationOption::Filter(filter)); |
| 832 | + if (err) { |
| 833 | + Serial.printf("[FIREBASE] SignIn JSON parse error: %s\n", err.c_str()); |
827 | 834 | firebaseAuth = false; |
828 | 835 | return false; |
829 | 836 | } |
|
0 commit comments