-
Notifications
You must be signed in to change notification settings - Fork 0
Added warning when public key is used #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
src/index.js
Outdated
@@ -320,6 +320,13 @@ 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") | |||
} | |||
|
|||
const isPublicSdkKey = clientSdkKey.split('-')[1] == 'public' ? true : false | |||
if(!isPublicSdkKey){ | |||
console.warn("To obtain the API key, please sign in to the Unlaunch Console at https://app.unlaunch.io" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 API key, please sign in ...
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We detected that you're not using the public SDK key to connect to Unlaunch from a browser SDK. For security reasons, we highly recommend using the public SDK key to access Unlaunch from JavaScript or other public SDKs. 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 'Browser / 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"
No description provided.