Hiding fetch request keys

I am using the new OMDB api and want the select requests (including the key) not to be displayed on the client side.

Here is an example of a problem when the user opens the tools dev: feelbad.

I make all my calls in React as follows:

  import OmdbKey from './OmdbKey';
  populate(keystrokes) {
    let query = "http://www.omdbapi.com/?s=";
    fetch(query + keystrokes + '&apikey=' + OmdbKey )
      .then((response) => {
        response.json().then((json) => {
          this.setState({ results: json.Search });
        });
      });
  }

Is there a way to do this so that I can hide the key in a GET request? How else should I approach this, if not?

thank

+4
source share

Source: https://habr.com/ru/post/1677615/


All Articles