Skip to content

Commit 5edf344

Browse files
committed
* updated sdk version
* added reverse proxy * added localt server url prop to properly configure redirectToMobile
1 parent fcc414a commit 5edf344

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

vite-web-sdk/.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VITE_TOKEN_SERVER_URL=<valid server with ssl correctly configured>
1+
VITE_TOKEN_SERVER_URL=/api
22
VITE_CLIENT_ID=<your client id>
3-
VITE_REDIRECT_URL=https://localhost:5173/
3+
VITE_LOCAL_SERVER_URL=https://your-ip:port/
44
VITE_API_URL=https://demo-api.incodesmile.com
5-
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.61.1.js
5+
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.69.0.js

vite-web-sdk/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,26 @@ Run `npm install`
1010
# Config
1111
Copy `.env.example` to `.env.local` and add your local values
1212
```
13+
VITE_TOKEN_SERVER_URL=/api
14+
VITE_CLIENT_ID=<client id>
15+
VITE_LOCAL_SERVER_URL=https://your-ip:port/
1316
VITE_API_URL=https://demo-api.incodesmile.com
14-
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.60.0.js
15-
VITE_CLIENT_ID=
16-
VITE_FLOW_ID=
17+
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.69.0.js
1718
```
1819
Remember the Flow holds the backend counter part of the process, some configurations there might affect the behavior of the WebSDK here.
1920

21+
# Backend Server
22+
A backend server that will generate the url is needed for this sample,
23+
luckily for you we already have sample server for PHP, NodeJS, Python,
24+
PHP and Java and .NET, please reffer to our documentation on subject:
25+
[Quick Start Sample Server](https://developer.incode.com/docs/quick-start-servers)
26+
27+
In order to simplfy development, this repo is configured to reverse
28+
proxy a local backend server (`http://localhost:3000`) in the `/api`
29+
url like `https://<your-ip>:5173/api`, if you want to point your
30+
frontend development to a backend server deployed elsewhere, change
31+
the VITE_TOKEN_SERVER_URL to the full url of such server.
32+
2033
# Run
2134
Vite is configured to serve the project using https and and expose him self, so you can easily test with your mobile phone on the local network.
2235

vite-web-sdk/vite.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import { defineConfig } from 'vite'
22
import mkcert from 'vite-plugin-mkcert'
33

44
export default defineConfig({
5-
server: { https: true },
5+
server: {
6+
https: true,
7+
proxy: {
8+
'/api': {
9+
target: 'http://localhost:3000',
10+
changeOrigin: true,
11+
secure: false,
12+
ws: true,
13+
rewrite: (path) => path.replace(/^\/api/, ''),
14+
}
15+
}
16+
},
617
plugins: [ mkcert() ]
718
})

0 commit comments

Comments
 (0)