From 5c802c8e4e3f9db94b6f95c09166ac9713241f79 Mon Sep 17 00:00:00 2001 From: "Peter.Morton" Date: Wed, 11 Oct 2023 19:20:46 -0500 Subject: [PATCH] Adding helper for auth key resolution --- src/helpers/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/helpers/index.js diff --git a/src/helpers/index.js b/src/helpers/index.js new file mode 100644 index 0000000..3fa8e1d --- /dev/null +++ b/src/helpers/index.js @@ -0,0 +1,12 @@ +export function getAuthKeyFromProperties(props) { + var authKey; + + if (props.sessionIdentifier && props.sessionIdentifier.length > 0) { + authKey = props.sessionIdentifier; + } else if (props.username && props.username.length > 0) { + authKey = props.username; + } else { + throw new Error('_sessionIdentifier or username properties not found (check query params)'); + } + return authKey +}