1

I am building an app in react-native in which it is necessary to translate texts dynamically, but it has not even been necessary to implement a backend, since everything is done directly from the app.

I want to implement the google cloud translate API, but I don't know if I need to implement a backend for this or if I can consume it directly from react-native.

The problem is that I need to use the API_KEY in the endpoints and I don't know how dangerous it could be to do this directly from react-native, of course the API_KEY value is stored in it .env

What can you recommend? Thanks so much

jhon sanchez
  • 43
  • 1
  • 6
  • 1
    Doing everything client-side means that the final user will have access to the API_KEY, something you most likely want to avoid if you paid for it. If the user has to supply his own key then it's perfectly fine. – Alejandro Dec 23 '22 at 20:46

1 Answers1

1

As @Alejandro mentioned in comments,

Doing everything client-side means that the final user will have access to the API_KEY, something you most likely want to avoid if you paid for it. If the user has to supply his own key then it's perfectly fine.

As of now, this is the best practice.

Posting the answer as community wiki for the benefit of the community that might encounter this use case in the future.

Feel free to edit this answer for additional information.

Scott B
  • 2,516
  • 1
  • 8
  • 15