Skip to content

[HOLD for payment 2023-08-03] [HOLD for payment 2023-08-02] [$1000] Dev: Web - User is unable to authenticate with magic link #23504

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Navigate to sign-in page
  2. Enter email & click on 'Continue' button
  3. Open email > copy magic link > paste it address bar > prefix the link with 'http://localhost:8080/' > press enter

Expected Result:

User should be authenticated

Actual Result:

User is not signed in

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: Dev 1.3.44-0
Reproducible in staging?: no
Reproducible in production?: no
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screencast.from.2023-07-24.12-09-33.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Natnael-Guchima
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690190001655879

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0117f832e71039be93
  • Upwork Job ID: 1683881238506196992
  • 2023-07-25
  • Automatic offers:
    • jjcoffee | Contributor | 25745592

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 24, 2023
  2. melvin-bot commented on Jul 24, 2023

    @melvin-bot

    Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. melvin-bot commented on Jul 24, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. StevenKKC commented on Jul 24, 2023

    @StevenKKC
    Contributor

    This seems to be a regression from this PR.
    If remove the following code, user can be authenticated.

    // A fresh session will not have credentials.login
    if (login) {
    User.validateLogin(accountID, validateCode);
    return;
    }

  5. kadiealexander commented on Jul 25, 2023

    @kadiealexander
    Contributor

    @NikkiWines @srikarparsi @johnmlee101 could you please take a look and see if this is a regression from #22461?

  6. Natnael-Guchima commented on Jul 25, 2023

    @Natnael-Guchima

    This is reproducible on staging too on the latest release.

    2023-07-25.06.46.09.mp4
  7. jjcoffee commented on Jul 25, 2023

    @jjcoffee
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Opening magic links should sign the user in.

    What is the root cause of that problem?

    This PR has introduced this bug here:

    // A fresh session will not have credentials.login
    if (login) {
    User.validateLogin(accountID, validateCode);
    return;
    }

    When we initiate the sign in flow, credentials.login is set, so User.validateLogin will always run as long as we stay in the same session. The issue is that User.validateLogin is actually the old password-based validation. You can see the purpose of the block a bit more clearly in this older commit:

    // Validate login if
    // - The user is not on passwordless beta
    if (!Permissions.canUsePasswordlessLogins(this.props.betas)) {
    User.validateLogin(this.getAccountID(), this.getValidateCode());
    return;
    }

    What changes do you think we should make in order to solve the problem?

    Remove this whole block as it was only there for password-based login:

    // A fresh session will not have credentials.login
    if (login) {
    User.validateLogin(accountID, validateCode);
    return;
    }

    We also should remove the if (!login) conditional here:

    // A fresh session will not have credentials.login available.
    if (!login) {
    if (lodashGet(props, 'session.authToken')) {
    // If already signed in, do not show the validate code if not on web,
    // because we don't want to block the user with the interstitial page.
    Navigation.goBack(false);
    } else {
    Session.signInWithValidateCodeAndNavigate(accountID, validateCode, preferredLocale);
    }
    } else {
    User.validateLogin(accountID, validateCode);
    }

    as we also don't want User.validateLogin to run here either. See the older commit below for a clearer understanding of the block's original purpose:

    if (Permissions.canUsePasswordlessLogins(props.betas)) {
    if (lodashGet(props, 'session.authToken')) {
    // If already signed in, do not show the validate code if not on web,
    // because we don't want to block the user with the interstitial page.
    Navigation.goBack(false);
    } else {
    Session.signInWithValidateCodeAndNavigate(accountID, validateCode, props.preferredLocale);
    }
    } else {
    User.validateLogin(accountID, validateCode);
    }

  8. NikkiWines commented on Jul 25, 2023

    @NikkiWines
    Contributor

    Hmm, this probably should've been marked as a deploy blocker since it was (previously) only on dev and is indeed a regression from #22461 as @StevenKKC pointed out.

  9. 55 remaining items

  10. Natnael-Guchima commented on Aug 4, 2023

    @Natnael-Guchima

    Accepted the offer. Thanks @kadiealexander

  11. kadiealexander commented on Aug 4, 2023

    @kadiealexander
    Contributor

    All paid! Please reopen if anything got missed.

  12. allroundexperts commented on Aug 4, 2023

    @allroundexperts
    Contributor

    @kadiealexander My payment for the C+ review is pending here.

  13. jjcoffee commented on Aug 4, 2023

    @jjcoffee
    Contributor

    @kadiealexander Would any compensation be due for me here, as my proposal was used for the fix? (I just couldn't implement it due to being in the "wrong" timezone and the fix was needed urgently!)

  14. pecanoro commented on Aug 4, 2023

    @pecanoro
    Contributor
  15. JmillsExpensify commented on Aug 8, 2023

    @JmillsExpensify
    Contributor

    Re-opening for confirmation on payment for @allroundexperts

  16. kadiealexander commented on Aug 8, 2023

    @kadiealexander
    Contributor

    Thanks Jason! I had this on my to-do for today. As discussed here we agreed to compensate @jjcoffee 50% of the job price as we used their proposal. The following payouts are due:

    Eligible for 50% #urgency bonus? No

    Upwork job is here.

  17. kadiealexander commented on Aug 8, 2023

    @kadiealexander
    Contributor

    @jjcoffee please let me know when you've accepted the Upwork contract.

  18. JmillsExpensify commented on Aug 8, 2023

    @JmillsExpensify
    Contributor

    No worries! Reviewed the details for @allroundexperts. This is approved for payment via NewDot.

  19. jjcoffee commented on Aug 8, 2023

    @jjcoffee
    Contributor

    @kadiealexander Accepted the offer, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringInternalRequires API changes or must be handled by Expensify staffNeeds ReproductionReproducible steps needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions