Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.49k stars 2.84k forks source link

[HybridApp] Receipt thumbnails are blank for a new unvalidated account sign-up #50712

Open Julesssss opened 1 week ago

Julesssss commented 1 week ago

Problem

Receipt scanning appears to be totally broken for a new account sign-up

UploadReciept logs

Device:

Version: v9.0.48-0
Device: iPhone 15 Pro, iOS 18.0.1

Reproduction steps:

IMG_0962

https://github.com/user-attachments/assets/c86f5040-97f5-4cd5-808c-6fc8b1b3ec75

Solution

investigate.

From @AndrewGable :

I would assume this is it: We share auth tokens between Old and New Apps and the encrypted auth token is used to view thumbnails due to “secured receipts” project. For some reason the encrypted auth token is the one that sometimes gets out of sync.

From @mateuuszzzzz:

The good news is that migrating to NewDot login page should solve this issue for us. But it will take some time to finish it. I bet we will need to handle this bug separately. I started research some time ago and here is related draft PR

From @trjExpensify:

P.s - that flow is super rough though. Why don’t we show the magic code input on the home page for the unvalidated account? On this btw, I think we need to do something about that in the name of #convert.

Julesssss commented 1 week ago

Just noting that this issue wil not block HybridApp release 9.0.47.4 as this is an existing authentication issue

mateuuszzzzz commented 1 week ago

FYI: Here's the draft PR where I was investigating this issue https://github.com/Expensify/Mobile-Expensify/pull/13144

mateuuszzzzz commented 5 days ago

I merged the latest main branches to find potential problems, and it turns out that the app sometimes crashes during Sign Up. I'm going to investigate this.

mateuuszzzzz commented 4 days ago

Hi, I have an update. It seems like we don’t return the encryptedAuthToken to the old app anymore, which is causing the current PR to break. We’re having a discussion about the next steps for the PR

mateuuszzzzz commented 3 days ago

Hi, I have a new update after another round of investigation.

I tried to implement another approach which was described here. Unfortunately, there are some issues with authentication on NewDot side with credentials generated on OldDot side (it's quite surprising, because It was working in the past 🤔).

I get the following error when I try to re-authenticate:

{"response": {"jsonCode": 404, "message": "404 No passwordless infinite login found.", "onyxData": [], "requestID": "8d4903949ac6b197-WAW"}

My guess is that we cannot make authentication request with HybridApp's partnerName (I compared how it behaves with NewDot partnerName and I did not encounter this issue).

I think we need someone from Expensify to look into this as it seems like backend issue.

Alternatively, we could switch to using NewDot's partnerName in HybridApp, but I'm not sure what impact that might have on the existing backend logic.

AndrewGable commented 3 days ago

@jasperhuangg - I think you were looking into this specific case on the backend, right?

jasperhuangg commented 3 days ago

@AndrewGable, I don’t think the issue is related to partnerName. Both the PARTNER_ANDROID and PARTNER_IPHONE are being considered in this condition, which must pass before reaching the logic that throws the exception.

The problem @mateuuszzzzz is encountering seems to be because we aren’t creating a temporary login for the user when they sign into HybridApp, unlike what we do for NewDot, which makes this check fail. When a temporary login is created, an NVP is also set, which is checked in situations like this.

This issue is similar to this one because both involve differences in the HybridApp sign-in flow compared to NewDot. However, the root cause in each case is different, as different parts of the sign-in flow are inconsistent. To clarify, the issue I'm assigned to is caused by the partnerNames being inconsistent between HybridApp and NewDot.

Julesssss commented 19 hours ago

I hope to have more time to help triage the backend issues soon.