Support validated links coming from e.com#5387
Conversation
|
PR for adding workspace/new is ready here: https://github.com/Expensify/App/pull/5396/files. This could be its own PR and I could add testing steps for it. Or I could merge it with this one which might help test that this PR works. I'm also trying to make sure urls where we do I'm going to work on the Web-Expensify part right now. |
| [SCREENS.LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE]: ROUTES.LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE, | ||
| [SCREENS.LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD]: ROUTES.LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD, | ||
| [SCREENS.LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD]: ROUTES.LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD, | ||
| LogInWithShortLivedToken: ROUTES.LOGIN_WITH_SHORTLIVED_AUTHTOKEN, |
There was a problem hiding this comment.
Should we put LogInWithShortLivedToken in a const under SCREEN?
| function signInWithShortLivedToken(accountID, email, shortLivedToken, encryptedAuthToken, exitTo) { | ||
| Onyx.merge(ONYXKEYS.ACCOUNT, {...CONST.DEFAULT_ACCOUNT_DATA, loading: true}); | ||
|
|
||
| createTemporaryLogin(shortLivedToken, encryptedAuthToken).then((response) => { |
There was a problem hiding this comment.
Is createTemporaryLogin missing the email param? Maybe it's not really needed in API.CreateLogin, but NAB we don't have to fix that in this PR
marcaaron
left a comment
There was a problem hiding this comment.
Leaving a few initial comments.
| partnerPassword: CONFIG.EXPENSIFY.PARTNER_PASSWORD, | ||
| partnerUserID: credentials.autoGeneratedLogin, | ||
| partnerUserSecret: credentials.autoGeneratedPassword, | ||
| authToken, |
There was a problem hiding this comment.
I am not really getting why the authToken is included when calling reauthenticate()? Maybe we could use a comment here or something. My previous understanding of this method is that we will use the credentials to get a new authToken not call it with the one already in storage or the last one we got when we called reauthenticate().
| function signInWithShortLivedToken(accountID, email, shortLivedToken) { | ||
| Onyx.merge(ONYXKEYS.ACCOUNT, {...CONST.DEFAULT_ACCOUNT_DATA, loading: true}); | ||
|
|
||
| createTemporaryLogin(shortLivedToken).then((response) => { |
There was a problem hiding this comment.
Is the fact that we are not passing an email to createTemporaryLogin going to create any sort of problem?
| * @param {String} email | ||
| * @return {Promise} | ||
| */ | ||
| function createTemporaryLogin(authToken, encryptedAuthToken, email) { |
There was a problem hiding this comment.
If we're making encryptedAuthToken and email optional we should update the docs
| const exitTo = decodeURIComponent(lodashGet(this.props.route.params, 'exitTo', '')); | ||
|
|
||
| // If the user is revisiting the component authenticated or they were already logged into the right account, we simply redirect them to the exitTo | ||
| if (this.props.session.authToken && email === this.props.session.email) { |
There was a problem hiding this comment.
NAB, it's good that we are checking if the email is the same. But it doesn't look like we are handling the case where it's not. We might not need to worry about this just yet, but feels like bad things would happen if you tried to sign in one user while still logged in as another.
| email, | ||
| }); | ||
| if (response.jsonCode === 200) { | ||
| getUserDetails(); |
There was a problem hiding this comment.
Oh hmm why are we doing this? It should happen when we set the authToken no?
App/src/libs/Navigation/AppNavigator/AuthScreens.js
Lines 185 to 186 in 1901df3
| }); | ||
| } | ||
|
|
||
| function signInWithShortLivedToken(accountID, email, shortLivedToken) { |
There was a problem hiding this comment.
- Don't we need to call authenticate with the short lived token before creating a login?
- We're calling
signInWithShortLivedToken(shortLivedToken)and not passing encrypted auth token, that means it'll be set to undefined insetSuccessfulSignInDataright?
| import Navigation from '../libs/Navigation/Navigation'; | ||
|
|
||
| const propTypes = { | ||
| /** The accountID and validateCode are passed via the URL */ |
| HOME: 'Home', | ||
| LOADING: 'Loading', | ||
| REPORT: 'Report', | ||
| LOG_IN_WITH_SHORT_LIVED_TOKEN: 'LogInWithShortLivedToken', |
There was a problem hiding this comment.
Can we align SHORTLIVED and SHORT_LIVED to help make this searchable?
There was a problem hiding this comment.
Oh true. Yes, I will once I figure out which PR we should be using.
|
This PR was replaced by #5396 |
Please review!
CC: @cead22, @tgolen, @marcaaron, @Luke9389
Details
Fixed Issues
https://github.com/Expensify/Expensify/issues/177739
Tests
See https://github.com/Expensify/Web-Expensify/pull/31977
QA Steps
+on the bottom right.Tested On
Screenshots
Included above