You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: web-integrations/javascript-sdk/server-side-node/README.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,11 @@ For more information on the JavaScript SDK, refer to the [UID2 SDK for JavaScrip
10
10
11
11
Unlike the browser where the SDK runs natively in the DOM, this example uses **jsdom** to simulate a browser environment within Node.js:
12
12
13
-
1.**Creates a virtual DOM**: Uses jsdom to provide `window`, `document`, and `navigator` objects that the SDK expects
14
-
2.**Polyfills browser APIs**: Adds Node.js equivalents for Web Crypto API (`crypto.subtle`) and text encoding APIs (`TextEncoder`/`TextDecoder`)
15
-
3.**Loads the SDK**: Fetches and executes the browser-based SDK code within the simulated environment
16
-
4.**Runs SDK methods**: Calls `setIdentityFromEmail` just like in a browser, with the same public credentials
13
+
1.**Imports the SDK**: Uses npm packages `@uid2/uid2-sdk` or `@unified-id/euid-sdk` (selected dynamically based on `IDENTITY_NAME`)
14
+
2.**Creates a virtual DOM**: Uses jsdom to provide `window`, `document`, and `navigator` objects that the SDK expects
15
+
3.**Polyfills browser APIs**: Adds Node.js equivalents for Web Crypto API (`crypto.subtle`) and text encoding APIs (`TextEncoder`/`TextDecoder`)
16
+
4.**Instantiates the SDK**: Creates a new instance of `UID2` or `EUID` class
17
+
5.**Runs SDK methods**: Calls `setIdentityFromEmail` just like in a browser, with the same public credentials
17
18
18
19
This demonstrates that the client-side SDK can be compatible with server-side Node.js environments when given the proper browser-like context.
19
20
@@ -61,10 +62,10 @@ The following table lists the environment variables that you must specify to sta
61
62
|`UID_SERVER_BASE_URL`| The base URL of the UID2/EUID service. For details, see [Environments](https://unifiedid.com/docs/getting-started/gs-environments) (UID2) or [Environments](https://euid.eu/docs/getting-started/gs-environments) (EUID). | UID2: `https://operator-integ.uidapi.com`<br/>EUID: `https://integ.euid.eu/v2`|
62
63
|`UID_CSTG_SUBSCRIPTION_ID`| Your UID2/EUID subscription ID for Client-Side Token Generation. **These are public credentials.**| Your assigned subscription ID (e.g., `DMr7uHxqLU`) |
63
64
|`UID_CSTG_SERVER_PUBLIC_KEY`| Your UID2/EUID server public key for Client-Side Token Generation. **These are public credentials.**| Your assigned public key |
64
-
|`UID_JS_SDK_URL`| URL to the UID2/EUID JavaScript SDK | UID2: `https://cdn.integ.uidapi.com/uid2-sdk-4.0.1.js`<br/>EUID: `https://cdn.integ.euid.eu/euid-sdk-4.0.1.js`|
65
-
|`UID_JS_SDK_NAME`| Global variable name for the SDK | UID2: `__uid2`<br/>EUID: `__euid`|
66
65
|`SESSION_KEY`| Used by the cookie-session middleware to encrypt the session data stored in cookies. | Any secure random string |
67
66
67
+
> **⚠️ Important**: Your CSTG subscription must be configured with `http://localhost:3034` as an allowed origin. Contact your UID2/EUID representative to add this origin to your subscription's allowed origins list.
0 commit comments