0

Is it possible to hide api key variable in JS code, hide it somehow or or encrypt it in the source code? Thanks.

5
  • Have a server in the middle that runs a server side language. NodeJS or PHP are the two easiest options. Commented Oct 31, 2016 at 3:24
  • how could that be done in PHP? Commented Oct 31, 2016 at 3:29
  • Get the PHP to listen to POSTS from Javascript, and then use something like cURL to foward the message with your API key. Commented Oct 31, 2016 at 3:30
  • ok, let me invesigate this. Do you have maybe some usful link that could help me achiving this? Thanks for now. Commented Oct 31, 2016 at 3:41
  • Have a look at this davidwalsh.name/curl-post this example is a server forwarding the requests. Commented Oct 31, 2016 at 20:13

1 Answer 1

3

Nope.

Javascript code is client-side. Client-side means out of your control.

You can obfuscate, encode, encrypt as much as you want, but the browser will always have access to this information if it is used client-side.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.