Skip to content

Commit d953970

Browse files
Updated to new guide (#7)
* switched to an unified startOnboarding endpoint * added saving of tokens to localStorage * upgraded dependencies * added details on the new implementation diagram * switched to not send the token to the frontend * unified code style
1 parent 8772896 commit d953970

6 files changed

Lines changed: 856 additions & 571 deletions

File tree

README.md

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ sequenceDiagram
88
participant i as Incode<br>Hosted<br>Workflow
99
participant m as Customer<br>Site
1010
participant b as Backend
11+
participant a as API
1112
1213
activate m
13-
m-->>b: Get Onboarding URL
14-
note over b: runs /omni/start,<br>/omni/onboarding-url
15-
b-->>m: {url, token}
14+
m->>b: Start Onboarding
15+
b->>a: configurationId
16+
note over a: /omni/start
17+
a->>b: token, interviewId
18+
note over b: Save Token
19+
b->>a: token
20+
note over a:/0/omni/onboarding-url
21+
a->>b: url
22+
b->>m: {url, interviewId}
1623
note over m: Create Iframe with URL
1724
m->>i: Onboarding starts in backend
1825
@@ -23,17 +30,23 @@ sequenceDiagram
2330
deactivate i
2431
and
2532
loop
26-
m-->>b: {token}
27-
note over b: Fetch Onboarding Status
28-
b-->>m: {onboardingStatus}
33+
m->>b: Get Status<br>{interviewId}
34+
note over b: Get Token
35+
b->>a: token
36+
note over a: /0/omni/get/onboarding/status
37+
a->>b: {onboardingStatus}
38+
b->>m: {onboardingStatus}
2939
note over m: If ONBOARDING_FINISHED then<br>continue
3040
end
3141
end
3242
3343
note over m: Destroy Iframe
34-
m-->>b: Fetch Score<br>{token}
35-
note over b: Fetch Score
36-
b-->>m: {overallStatus}
44+
m->>b: Fetch Score<br>{interviewId}
45+
note over b: Get Token
46+
b->>a: token
47+
note over a: /0/omni/get/score
48+
a->>b: {overallStatus}
49+
b->>m: {overallStatus}
3750
note over m: Done
3851
deactivate m
3952
```
@@ -50,7 +63,7 @@ The APIKEY should never be exposed in the frontend.
5063

5164
# Install
5265
First install all the required packages
53-
```
66+
```bash
5467
npm install
5568
```
5669

@@ -66,14 +79,25 @@ VITE_FAKE_BACKEND_FLOWID=
6679

6780
# Development
6881
This repo is configured so run it in development by executing
69-
```
82+
```bash
7083
npm run dev
7184
```
7285

7386
You will get a hot reloading environment that exposes the page in
7487
localhost and in the ip of the machine in case you want to try it
7588
in your cellphone.
7689

90+
## Session Storage
91+
92+
This sample application uses localStorage to store session data (token and interviewId). In a production environment, you should:
93+
94+
1. Store tokens securely on your backend
95+
2. Implement proper session management
96+
3. Handle token expiration and renewal
97+
4. Consider security implications of storing sensitive data
98+
99+
The implementation in this demo is for demonstration purposes only.
100+
77101
# Author
78102

79103
© Incode Technologies Inc. All rights reserved.

index.html

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="stylesheet" href="/styles/main.css" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Sample iframe App</title>
8+
</head>
39

4-
<head>
5-
<meta charset="UTF-8" />
6-
<link rel="stylesheet" href="/styles/main.css" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>Sample iframe App</title>
9-
</head>
10-
11-
<body>
12-
<header id="header">Sample iframe App</header>
13-
<div id="app">
14-
</div>
15-
<header id="footer">Copyright 2024&copy;</header>
16-
<script type="module" src="/src/main.js"></script>
17-
</body>
18-
19-
</html>
10+
<body>
11+
<header id="header">Sample iframe App</header>
12+
<div id="app"></div>
13+
<header id="footer">Copyright 2024&copy;</header>
14+
<script type="module" src="/src/main.js"></script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)