File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 44 < meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 ">
55</ head >
66< body >
7+
8+ < script type ='text/javascript '>
9+ async function fetchAndSetIdentityToken ( ) {
10+ const identityToken = await fetchIdentityToken ( ) ;
11+ embeddedservice_bootstrap . userVerificationAPI . setIdentityToken ( {
12+ identityTokenType : "JWT" ,
13+ identityToken : identityToken
14+ } ) ;
15+ }
16+
17+ function fetchIdentityToken ( ) {
18+ const porticoURL = "https://portico.sfproxy.controltelemetry-s.aws-esvc1-useast2.aws.sfdc.cl/api/v1/miaw/getJwtToken?issuer=testIssuer&subject=testSubject@cwc.com&jwtExpInSeconds=600&keyId=5f103f1b-ee38-404c-ac94-83c427764813" ;
19+ return fetch ( porticoURL ) . then ( function ( response ) {
20+ return response . json ( ) ;
21+ } ) ;
22+ }
23+
24+
25+ window . addEventListener ( "onEmbeddedMessagingReady" , ( ) => {
26+ console . log ( "Received the onEmbeddedMessagingReady event…" ) ;
27+ fetchAndSetIdentityToken ( ) ;
28+ } ) ;
29+
30+
31+ window . addEventListener ( "onEmbeddedMessagingIdentityTokenExpired" , ( ) => {
32+ console . log ( "Received the onEmbeddedMessagingTokenExpired event…" ) ;
33+ fetchAndSetIdentityToken ( ) ;
34+ } ) ;
35+ </ script >
36+
37+
738< script type ='text/javascript '>
839 function initEmbeddedMessaging ( ) {
940 try {
You can’t perform that action at this time.
0 commit comments