H
H
Huntgold2021-10-16 18:16:08
JavaScript
Huntgold, 2021-10-16 18:16:08

How to hide API in JS from users?

Good afternoon. Now I'm learning React and ran into the problem of implementing API requests that should not fall on the side of users. Usually this is done through the backend. I know that it cannot be implemented through JS, as users will have access to the API token. Tell me, is it possible to access the API with a token through React without providing data to the user and pass the result to the frontend? Need to learn NodeJS? In general, in a nutshell. I need to work with API tokens that should not fall into the hands of the user, but it will take a lot of time to learn the backend, PHP, NodeJS, etc. to implement. Therefore, I want to know if there is a not so long learning path to implement the transfer of an API token and display only the necessary (not anonymous) information in the frontend

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2021-10-16
@sergiks

You can raise a free Worker on CloudFlare if you use it for a domain. The worker code is not visible to users. See answer for details .

B
bitwheeze, 2021-10-16
@bitwheeze

Here only SSR will help or some kind of proxy api. That is, the server part will be needed in any case.

A
allaga, 2021-10-28
@allaga

https://heynode.com/tutorial/what-api-proxy/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question