Skip to content

Commit b155824

Browse files
committed
Demo App changes to reflect persistence
1 parent 555e960 commit b155824

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/auth/demo/public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@
853853
</div>
854854
<div class="tab-pane" id="tab-byo-ciam-content">
855855
<h2>Sign in with your CIAM token</h2>
856+
<div id="firebase-token-status">No CIAM token found. User not logged in.</div>
856857
<input type="text" id="byo-ciam-token"
857858
class="form-control" placeholder="Enter CIAM token" />
858859
<button class="btn btn-block btn-primary"

packages/auth/demo/src/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,16 +1521,16 @@ async function exchangeCIAMToken(token) {
15211521
function onExchangeToken(event) {
15221522
event.preventDefault();
15231523
const byoCiamInput = document.getElementById('byo-ciam-token');
1524-
const byoCiamResult = document.getElementById('byo-ciam-result');
1525-
1526-
byoCiamResult.textContent = 'Exchanging token...';
1524+
const firebaseTokenStatus = document.getElementById('firebase-token-status');
15271525

1526+
firebaseTokenStatus.textContent = 'Exchanging token...';
15281527
exchangeCIAMToken(byoCiamInput.value)
15291528
.then(response => {
1530-
byoCiamResult.textContent = response;
1529+
firebaseTokenStatus.textContent = '✅ Firebase token is set: ' + response;
15311530
console.log('Token:', response);
15321531
})
15331532
.catch(error => {
1533+
(firebaseTokenStatus.textContent = 'Error exchanging token: '), error;
15341534
console.error('Error exchanging token:', error);
15351535
});
15361536
}
@@ -2092,6 +2092,15 @@ function initApp() {
20922092
tenantConfig: tenantConfig
20932093
});
20942094

2095+
const firebaseTokenStatus = document.getElementById('firebase-token-status');
2096+
setTimeout(() => {
2097+
if (regionalAuth.firebaseToken) {
2098+
firebaseTokenStatus.textContent = '✅ Firebase token is set: ' + regionalAuth.firebaseToken.token;
2099+
} else {
2100+
firebaseTokenStatus.textContent = 'No CIAM token found. User not logged in.';
2101+
}
2102+
console.log("firebaseToken after delay: ", regionalAuth.firebaseToken);
2103+
}, 1000);
20952104
tempApp = initializeApp(
20962105
{
20972106
apiKey: config.apiKey,

0 commit comments

Comments
 (0)