From 13458ffc15e907ca99aaab4735031ba42e1049dc Mon Sep 17 00:00:00 2001 From: Ionatan Wiznia Date: Mon, 20 Sep 2021 20:47:56 +0200 Subject: [PATCH 1/3] Fix link to oldDot --- src/CONST.js | 4 ++-- src/libs/API.js | 8 ++++---- src/libs/actions/App.js | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index 206ac649f5e5..9e9932cefcb0 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -127,8 +127,8 @@ const CONST = { PRIVACY_URL: 'https://use.expensify.com/privacy', LICENSES_URL: 'https://use.expensify.com/licenses', PLAY_STORE_URL: 'https://play.google.com/store/apps/details?id=com.expensify.chat&hl=en', - ADD_SECONDARY_LOGIN_URL: '/settings?param={%22section%22:%22account%22}', - MANAGE_CARDS_URL: '/domain_companycards', + ADD_SECONDARY_LOGIN_URL: 'settings?param={%22section%22:%22account%22}', + MANAGE_CARDS_URL: 'domain_companycards', FEES_URL: 'https://use.expensify.com/fees', CFPB_PREPAID_URL: 'https://cfpb.gov/prepaid', STAGING_SECURE_URL: 'https://staging-secure.expensify.com/', diff --git a/src/libs/API.js b/src/libs/API.js index d817172f91e3..3f35f9f6caa0 100644 --- a/src/libs/API.js +++ b/src/libs/API.js @@ -433,11 +433,11 @@ function GetAccountStatus(parameters) { } /** - * Returns a validate code for this account + * Returns a short lived authToken for this account * @returns {Promise} */ -function GetAccountValidateCode() { - const commandName = 'GetAccountValidateCode'; +function GetShortLivedAuthToken() { + const commandName = 'GetShortLivedAuthToken'; return Network.post(commandName); } @@ -1086,7 +1086,7 @@ export { DeleteLogin, Get, GetAccountStatus, - GetAccountValidateCode, + GetShortLivedAuthToken, GetIOUReport, GetPolicyList, GetPolicySummaryList, diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index c7ac52b5134b..b163e631c7ac 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -48,10 +48,8 @@ function setLocale(locale) { * @param {string} url relative URL starting with `/` to open in expensify.com */ function openSignedInLink(url = '') { - API.GetAccountValidateCode().then((response) => { - const exitToURL = url ? `?exitTo=${url}` : ''; - const validateCodeUrl = `v/${currentUserAccountID}/${response.validateCode}${exitToURL}`; - Linking.openURL(CONFIG.EXPENSIFY.URL_EXPENSIFY_COM + validateCodeUrl); + API.GetShortLivedAuthToken().then((response) => { + Linking.openURL(`${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${response.authToken}`); }); } From 14e86227312a48b0f05ff9fe6898cdacf5af948c Mon Sep 17 00:00:00 2001 From: Carlos Alvarez Date: Mon, 20 Sep 2021 16:43:44 -0700 Subject: [PATCH 2/3] Pass email in query string --- src/libs/actions/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index b163e631c7ac..790df781b63d 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -49,7 +49,7 @@ function setLocale(locale) { */ function openSignedInLink(url = '') { API.GetShortLivedAuthToken().then((response) => { - Linking.openURL(`${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${response.authToken}`); + Linking.openURL(`${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${response.authToken}&email=${response.email}`); }); } From bb91eb89383ab85e775b5fe9394348f9767adb9a Mon Sep 17 00:00:00 2001 From: Carlos Alvarez Date: Mon, 20 Sep 2021 17:13:35 -0700 Subject: [PATCH 3/3] Encode email --- src/libs/actions/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/App.js b/src/libs/actions/App.js index 790df781b63d..c466fa7e4deb 100644 --- a/src/libs/actions/App.js +++ b/src/libs/actions/App.js @@ -49,7 +49,7 @@ function setLocale(locale) { */ function openSignedInLink(url = '') { API.GetShortLivedAuthToken().then((response) => { - Linking.openURL(`${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${response.authToken}&email=${response.email}`); + Linking.openURL(`${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${response.authToken}&email=${encodeURIComponent(response.email)}`); }); }