Hello good day.
How can I hide stripe api key in javascript?
It is showing up on the console. any idea how to solve this problem?
Thanks. Good morning everyone.
@Sinnbeck Yes, I wanted to know how to load it through the .env file without it being displayed in the javascript code.
Any idea? thanks for your reply
@YuMp if you need to use it inside Javascript, then people can find it. All Javascript is run inside the users browser, so best you can do is obfuscation (which isnt secure).
Only server side languages can load keys without leaking
@Sinnbeck Hi, even though I know he is not displaying the secret key which makes me relieved but thank you very much, you opened my mind.
I did the following, stored the key in the database and called it on the blade.
I don't know if it's right, but I believe it can solve part of the problems.
var stripe = Stripe('{{ $form->key}}');
Thanks
@YuMp The public key is meant to be used in the front end, it's the secret key you have to worry about. As long as you don't show the secret key anywhere a user can see, you're good.