Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$500] Get $250 - Invalid Invite link URL for users signed in with Login with Google icon #34977

Closed
4 of 6 tasks
kbecciv opened this issue Jan 23, 2024 · 15 comments
Closed
4 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kbecciv
Copy link

kbecciv commented Jan 23, 2024

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


Version Number: 1.4.30-0
Reproducible in staging?: y
Reproducible in production?: y
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Issue found when executing PR #34360

Action Performed:

  1. Go to staging.new.expensify.com signed out
  2. Click on the Google icon on the start of the page
  3. Click on your avatar > Share code > Get 250
  4. Click on 'Copy invite link'

Expected Result:

Α URL with the invite link is shown that has the logged in email

Actual Result:

A URL with just the invite page without any mention of logged in user, when the user is logged using the Google's SSO and not a magic link

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6352076_1706023741909.Recording__612a.mp4
Bug6352076_1706023741913.Recording__610.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bb51369a85f79a26
  • Upwork Job ID: 1749840021441060864
  • Last Price Increase: 2024-01-23
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 23, 2024
@melvin-bot melvin-bot bot changed the title Get $250 - Invalid Invite link URL for users signed in with Login with Google icon [$500] Get $250 - Invalid Invite link URL for users signed in with Login with Google icon Jan 23, 2024
Copy link

melvin-bot bot commented Jan 23, 2024

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

Copy link

melvin-bot bot commented Jan 23, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01bb51369a85f79a26

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 23, 2024
Copy link

melvin-bot bot commented Jan 23, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @0xmiroslav (External)

@kbecciv
Copy link
Author

kbecciv commented Jan 23, 2024

We think that this bug might be related to #wave9-collect-signup
CC @MitchExpensify

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 23, 2024

Proposal

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

A URL with just the invite page without any mention of logged in user, when the user is logged using the Google's SSO and not a magic link

What is the root cause of that problem?

When logging in via Google SSO, the primaryLogin (used in the invite URL) is not available in account data, so the URL constructed here doesn't have the email of the inviting user.

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

We should fallback to session.email if there's no account.primaryLogin, the session.email holds the same data as account.primaryLogin and can be used for this use case. We could even replace the usage of account.primaryLogin by session.email, and optionally do that in other places that use account.primaryLogin.

What alternative solutions did you explore? (Optional)

NA

@0xmiros
Copy link
Contributor

0xmiros commented Jan 23, 2024

@dukenv0307's proposal looks good to me.

We can use the same approach as here:

return `otpauth://totp/Expensify:${account.primaryLogin || session.email}?secret=${account.twoFactorAuthSecretKey}&issuer=Expensify`;

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 23, 2024

Triggered auto assignment to @danieldoglas, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@FitseTLT
Copy link
Contributor

FitseTLT commented Jan 23, 2024

Proposal

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

Get $250 - Invalid Invite link URL for users signed in with Login with Google icon

What is the root cause of that problem?

When account is not populated with primaryLogin the invite link will be without the login in the link

const referralLink = `${CONST.REFERRAL_PROGRAM.LINK}${account?.primaryLogin ? `/?thanks=${account.primaryLogin}` : ''}`;

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

We should have a fallback of credentials.login in case the account has no primaryLogin

account.primaryLogin || credentials.login

What alternative solutions did you explore? (Optional)

@suneox
Copy link
Contributor

suneox commented Jan 23, 2024

Proposal

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

Get $250 - Invalid Invite link URL for users signed in with Login with Google icon

What is the root cause of that problem?

When sign-in with Google, we do not set primaryLogin into optimisticData for ONYXKEYS.ACCOUNT and BE is also not return primaryLogin so when get referralLink we don't have primaryLogin

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

Currently the primaryLogin is using a lot of places so we will update optimisticData when sign-in with Google to avoid another issue the same with this.

When begin sign-in with Google we will email from jwt token and then pass into signInAttemptState function

function beginGoogleSignIn(token: string | null) {
+   const email = token ? parseJwtToJson(token).email : null;
+   const { optimisticData, successData, failureData } = signInAttemptState(email);

Then set primaryLogin for optimisticData or successData

function signInAttemptState(primaryLogin?:string | null): OnyxData {
    return {
        optimisticData: [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: ONYXKEYS.ACCOUNT,
                value: {
                    ...CONST.DEFAULT_ACCOUNT_DATA,
                    isLoading: true,
                    message: null,
                    loadingForm: CONST.FORMS.LOGIN_FORM,
+                   primaryLogin,
                },
            },
        ],
        .....

What alternative solutions did you explore? (Optional)

When sign-in with Google BE must return primaryLogin email

@situchan
Copy link
Contributor

Dupe of #32292. We should reopen #32292 as it has full context

@mallenexpensify mallenexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Jan 24, 2024
Copy link

melvin-bot bot commented Jan 24, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 (External)

@mallenexpensify
Copy link
Contributor

@cubuspl42 reassigning, please take over as C+. If you don't have bandwidth, unassign yourself. Thanks

@situchan
Copy link
Contributor

@mallenexpensify can you please reopen #32292 and close this one? It's dupe

@cubuspl42
Copy link
Contributor

It indeed looks like a dupe! I'll unassign myself in such a case. If the decision is changed, please re-assign me.

@cubuspl42 cubuspl42 removed their assignment Jan 25, 2024
@alexpensify
Copy link
Contributor

Thanks for the feedback-- I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

10 participants