Answer the question
In order to leave comments, you need to log in
Calling the service API. What is more correct?
Good afternoon!
I am implementing a form that, when sending data, accesses a third-party API (VoIP telephony service), in the first version I did this using curl in php, i.e. there was a scheme:
- form - sending data to ajax in a php script, - curl - response from the service in json - parsed, - we issue answers.
In the second version, I found the opportunity to implement the task directly in jquery, i.e. Now the call and the answer are right in the js file.
In this regard, questions:
1. This is the easiest in terms of structure, but is it more correct than the first option? Because:
- A security issue: in js, the secret key and login for accessing the API will glow, although I have already found how to close js from prying eyes - but still - is it safe?
2. How to get data from the database in a js file - the same logins and passwords and secret keys are stored differently in the database, because in different requests they change depending on what is selected in the initial form.
Answer the question
In order to leave comments, you need to log in
Well hello, head of the web studio.
Unfortunately, you will not be able to hide js, and with it private keys to the API.
I already found how to close js from prying eyes - but still - is it safe
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question