From 5995b27d545c82920b27f9d654f39a79c68d151c Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Tue, 10 Oct 2023 09:07:08 +0000 Subject: [PATCH] adds condition for token to authenticate --- examples/crypto-websockets/server/auth/websocket.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/crypto-websockets/server/auth/websocket.ts b/examples/crypto-websockets/server/auth/websocket.ts index 89506aa8e..22c7ffff8 100644 --- a/examples/crypto-websockets/server/auth/websocket.ts +++ b/examples/crypto-websockets/server/auth/websocket.ts @@ -10,7 +10,11 @@ export async function serverAuth({ authProps, done }) { console.log("token", authProps.getToken()) console.log("userpass", authProps.getUserPass()) - done(false) + if (authProps.getToken().split(' ')[1] === process.env.TOKEN) { + done(true); + } else { + done(false); + } } export async function clientAuth({ parsedAsyncAPI, serverName }) {