Skip to content

Commit 9a18a53

Browse files
committed
SDK-810: Allow API URLs to be configured
1 parent cc00c04 commit 9a18a53

File tree

6 files changed

+34
-17
lines changed

6 files changed

+34
-17
lines changed

examples/.env.dist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ YOTI_APP_ID=xxxxxxxxxxxxxxxxxx
55
YOTI_SCENARIO_ID=xxxxxxxxxxxxxxxx
66
YOTI_SDK_ID=xxxxxxxxxxxxxxxxxxxxx
77
# Below is the private key (in .pem format) associated with the Yoti Application you created on Dashboard
8-
YOTI_KEY_FILE_PATH=/path_to_pem_dir/php-sdk-access-security.pem
8+
YOTI_KEY_FILE_PATH=/path_to_pem_dir/php-sdk-access-security.pem
9+
10+
# Change the API URLs (optional)
11+
YOTI_CONNECT_API=xxxxxxxxxxxxxxxx
12+
YOTI_QR_URL=xxxxxxxxxxxxxxxx
13+
YOTI_CONNECT_URL=xxxxxxxxxxxxxxxx

examples/assets/css/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@
166166

167167
.yoti-app-button-link {
168168
text-decoration: none;
169-
}
169+
}

examples/composer.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/error.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
</head>
77
<body class="yoti-body">
88
<h2><a href="/">Home</a></h2>
9-
<h3>Could not login user for the following reason: <?php echo isset($_GET['msg']) ? $_GET['msg'] : '' ?> </h3>
9+
<h3>Could not login user for the following reason: <?php echo isset($_GET['msg']) ? htmlspecialchars($_GET['msg']) : '' ?> </h3>
1010
</body>
1111
</html>

examples/index.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@
7171

7272
<script src="https://sdk.yoti.com/clients/browser.2.2.0.js"></script>
7373
<script>
74-
_ybg.init()
74+
<?php if (getenv('YOTI_QR_URL')) { ?>
75+
_ybg.config.qr = "<?php echo getenv('YOTI_QR_URL'); ?>";
76+
<?php } ?>
77+
<?php if (getenv('YOTI_CONNECT_URL')) { ?>
78+
_ybg.config.service = "<?php echo getenv('YOTI_CONNECT_URL'); ?>";
79+
<?php } ?>
80+
_ybg.init();
7581
</script>
7682
</body>
7783
</html>

examples/profile.inc.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
$token = isset($_GET['token']) ? $_GET['token'] : '';
88
$profileAttributes = [];
99

10+
// Allow Connect API to be configured.
11+
$connect_api = Yoti\YotiClient::DEFAULT_CONNECT_API;
12+
if (!empty(getenv('YOTI_CONNECT_API'))) {
13+
$connect_api = getenv('YOTI_CONNECT_API');
14+
}
15+
1016
try {
11-
$yotiClient = new Yoti\YotiClient(getenv('YOTI_SDK_ID'), getenv('YOTI_KEY_FILE_PATH'));
17+
$yotiClient = new Yoti\YotiClient(getenv('YOTI_SDK_ID'), getenv('YOTI_KEY_FILE_PATH'), $connect_api);
1218
$activityDetails = $yotiClient->getActivityDetails($token);
1319
$profile = $activityDetails->getProfile();
1420

0 commit comments

Comments
 (0)