diff --git a/src/index.js b/src/index.js index 810df60..940dbf0 100644 --- a/src/index.js +++ b/src/index.js @@ -320,6 +320,12 @@ export function initialize(clientSdkKey, flagKeys, user, specifiedOptions, platf console.warn("[UL] Disabling local storage in production is not recommended. Please enable it. For more information see: https://docs.unlaunch.io/docs/sdks/javascript-library#client-configuration") } + if(clientSdkKey.split('-')[1] !== 'public'){ + console.warn("You're using NOT using public key to connect to Unlaunch. If your application is client-side, not using public key can compromise security. To obtain the public SDK key, please sign in the Unlaunch Console at https://app.unlaunch.io" + +". Then on the right sidebar, click on 'Settings'. Then from the 'Projects' tab. Copy the 'PUBLIC KEY' for the " + +"environment you want to connect to, and provide it to this SDK. For more information, visit: https://docs.unlaunch.io/docs/sdks/sdk-keys") + } + ident.setUser(realUser); if (useLocalStorage) { console.log("finishInitWithLocalStorage"); diff --git a/src/messages.js b/src/messages.js index 720b469..15eac4e 100644 --- a/src/messages.js +++ b/src/messages.js @@ -14,7 +14,7 @@ export const clientInitialized = function() { return 'Unlaunch client initialized'; }; -const invalidSdkKeyHelpMsg = `To obtain the SDK key for your project, please sign in to the Unlaunch Console at https://app.unlaunch.io Then on the right sidebar, click on 'Settings'. From the 'Projects' tab, Copy the 'Browser / Public Key' for the environment you want to connect with, and provide it to this SDK. For more information, see this: https://docs.unlaunch.io/docs/sdks/sdk-keys`; +const invalidSdkKeyHelpMsg = "To obtain the SDK key, please sign in to the Unlaunch Console at https://app.unlaunch.io. Then on the right sidebar, click on 'Settings'. Then from the 'Projects' tab. Copy the 'PUBLIC KEY' for the environment you want to connect to, and provide it to this SDK. For more information, visit: https://docs.unlaunch.io/docs/sdks/sdk-keys" const docLink = "Read more at https://docs.unlaunch.io/docs/sdks/javascript-library"