Skip to content

Commit 191c7c9

Browse files
authored
Merge pull request #3981 from wmathurin/consumer_key_in_env
Removing consumer key from sample apps
2 parents ba4c2b3 + a38d0d6 commit 191c7c9

6 files changed

Lines changed: 38 additions & 28 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ project.xcworkspace
55
artifacts
66
node_modules
77
shared/test/test_credentials.json
8+
bootconfig.plist
89
/SalesforceMobileSDK.xcworkspace/xcshareddata/SalesforceMobileSDK.xccheckout
910
/SalesforceMobileSDK.xcworkspace/xcshareddata/SalesforceMobileSDK.xcscmblueprint
1011
/SalesforceMobileSDK.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

install.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Run this script before working with the SalesforceMobileSDK Xcode workspace.
77
#
88

9+
# Run from repo root so relative paths work regardless of invocation directory
10+
cd "$(dirname "$0")"
11+
912
# Check for iOS SDK minimum version
1013
IOS_MIN_VERSION_NUM=170
1114
IOS_MIN_VERSION_STR="iOS 17.0"
@@ -45,3 +48,31 @@ if [ ! -f "shared/test/test_credentials.json" ]
4548
then
4649
cp shared/test/test_credentials.json.sample shared/test/test_credentials.json
4750
fi
51+
52+
# Create bootconfig.plist from shared sample
53+
BOOTCONFIG_SAMPLE="shared/bootconfig.plist.sample"
54+
BOOTCONFIG_PATHS=(
55+
"native/SampleApps/AuthFlowTester/AuthFlowTester/Supporting Files/bootconfig.plist"
56+
"native/SampleApps/RestAPIExplorer/RestAPIExplorer/bootconfig.plist"
57+
"native/SampleApps/MobileSyncExplorer/MobileSyncExplorer/bootconfig.plist"
58+
)
59+
for bootconfig in "${BOOTCONFIG_PATHS[@]}"; do
60+
mkdir -p "$(dirname "$bootconfig")"
61+
cp "$BOOTCONFIG_SAMPLE" "$bootconfig"
62+
63+
# Substitute env vars if set
64+
if [ -n "${MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY:-}" ]; then
65+
gsed -i "s|__CONSUMER_KEY__|${MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY}|g" "$bootconfig"
66+
fi
67+
if [ -n "${MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL:-}" ]; then
68+
gsed -i "s|__REDIRECT_URI__|${MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL}|g" "$bootconfig"
69+
fi
70+
done
71+
72+
if [ -z "${MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY:-}" ] || [ -z "${MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL:-}" ]; then
73+
echo ""
74+
echo "Note: MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY and/or MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL are not set."
75+
echo "To run the sample applications, define these environment variables or manually provide"
76+
echo "a bootconfig.plist (with remoteAccessConsumerKey and oauthRedirectURI) in each sample app."
77+
echo ""
78+
fi

native/SampleApps/MobileSyncExplorer/MobileSyncExplorer/bootconfig.plist

Lines changed: 0 additions & 10 deletions
This file was deleted.

native/SampleApps/RestAPIExplorer/RestAPIExplorer/bootconfig.plist

Lines changed: 0 additions & 12 deletions
This file was deleted.

native/SampleApps/AuthFlowTester/AuthFlowTester/Supporting Files/bootconfig.plist renamed to shared/bootconfig.plist.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<plist version="1.0">
44
<dict>
55
<key>remoteAccessConsumerKey</key>
6-
<string>3MVG9SemV5D80oBcXZ2EUzbcJwzJCe2n4LaHH_Z2JSpIJqJ1MzFK_XRlHrupqNdeus8.NRonkpx0sAAWKzfK8</string>
6+
<string>__CONSUMER_KEY__</string>
77
<key>oauthRedirectURI</key>
8-
<string>testeropaque://mobilesdk/done</string>
8+
<string>__REDIRECT_URI__</string>
99
<key>shouldAuthenticate</key>
1010
<true/>
1111
</dict>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22

3-
"access_token":"__NOT_REQUIRED__",
3+
"access_token":"__NOT_REQUIRED__",
44

55
"test_client_id":"__INSERT_REMOTE_ACCESS_CLIENT_KEY_HERE__",
66

7-
"test_login_domain":"test.salesforce.com",
7+
"test_login_domain":"__INSERT_LOGIN_URL_HERE__",
88

99
"test_redirect_uri":"__INSERT_REMOTE_ACCESS_CALLBACK_URL_HERE__",
1010

1111
"refresh_token":"__INSERT_TOKEN_HERE__",
1212

13-
"instance_url":"https://cs1.salesforce.com",
13+
"instance_url":"__INSERT_INSTANCE_URL_HERE__",
1414

15-
"identity_url":"https://test.salesforce.com"
15+
"identity_url":"__INSERT_IDENTITY_URL_HERE__"
1616

1717
}

0 commit comments

Comments
 (0)