1111// 4. Return the token to the front-end for use with Prebid.js
1212// ============================================================================
1313
14- // Load environment variables from .env file (for local development)
14+
1515require ( 'dotenv' ) . config ( { path : '../../../.env' } ) ;
1616
1717const axios = require ( 'axios' ) ;
@@ -28,15 +28,15 @@ const uid2ApiKey = process.env.UID2_API_KEY; // Your API Key from UID2
2828const uid2ClientSecret = process . env . UID2_CLIENT_SECRET ; // Your Client Secret from UID2 Portal
2929
3030// Encryption constants required by UID2 API
31- const ivLength = 12 ; // Initialization vector length
32- const nonceLength = 8 ; // Nonce (random number) length
33- const timestampLength = 8 ; // Timestamp length
34- const encryptionAlgo = 'aes-256-gcm' ; // AES-256-GCM encryption algorithm
31+ const ivLength = 12 ;
32+ const nonceLength = 8 ;
33+ const timestampLength = 8 ;
34+ const encryptionAlgo = 'aes-256-gcm' ;
3535
3636// Middleware setup
37- app . use ( express . static ( 'public' ) ) ; // Serve static files (HTML, CSS, JS) from 'public' folder
38- app . use ( express . json ( ) ) ; // Parse JSON request bodies
39- app . use ( express . urlencoded ( { extended : true } ) ) ; // Parse URL-encoded form data
37+ app . use ( express . static ( 'public' ) ) ;
38+ app . use ( express . json ( ) ) ;
39+ app . use ( express . urlencoded ( { extended : true } ) ) ;
4040
4141// ============================================================================
4242// HELPER FUNCTIONS FOR ENCRYPTION/DECRYPTION
@@ -200,9 +200,5 @@ app.post('/login', async (req, res) => {
200200// ============================================================================
201201app . listen ( port , ( ) => {
202202 console . log ( `UID2 Prebid Client-Server example listening at http://localhost:${ port } ` ) ;
203- console . log ( `Make sure you have set the following environment variables:` ) ;
204- console . log ( ` - UID2_API_KEY` ) ;
205- console . log ( ` - UID2_CLIENT_SECRET` ) ;
206- console . log ( ` - UID2_BASE_URL (optional, defaults to integration environment)` ) ;
207203} ) ;
208204
0 commit comments