I am wondering about the security of my mobile app. I want to avoid the case where "legitimate" users (i.e. users that have a real account on my app) copy their tokens to spam arbitrary requests to my backend. Here is my setup:
I have a Firebase cloud function backend and a react-native mobile app frontend. Users that are authenticated on the frontend using firebase auth get an ID token. They can use this token to make requests to the cloud function. The cloud function checks the ID token's validity and then processes the request.
The ID token provides little protection against "legitimate" users. A user can just copy their ID token (e.g. using a rooted phone) and use it to send arbitrary requests with e.g. curl. The ID token will expire at some point, but I suppose the user could just copy the refresh token as well and then automatically refresh their ID token.
Firebase also offers an "app-check" that supposedly checks if the request was sent from my app on a real android device. However, as I understand it, all that app-check does is create another token which is then passed on to the backend and verified there. While this might offer some protection for the user, it faces the same problem as the ID token when it comes to preventing spam from "legitimate" users.
As I see it, these security measures are not meant to protect my backend against arbitrary requests of legitimate users. Rather they protect the user (which is great, but besides my point here). If I want to prevent spam, I would need to implement something like a rate limit on my backend. Is this assessment correct, or am I mistaken? Is there some way the app-check token prevents the user from just copying the token?