You can do as Tommy Crush suggests and add a secret to your application. But if you're against smart opponents, this probably won't help. Attackers can either decompile your application, or try just rebuilding the signature algorithm.
It is important to remember that everything that is stored in your application should be considered already compromised, since an attacker can decompile your application and comb your code as much as he likes and extract from it everything that he wants from him, you cannot rely to anything in your application to be safe in your application, because an attacker could extract it from your application into your application.
It is important to note that you are using an attempt to use OAuth for authentication for which it is not intended. It just means authorization that does not match authentication. Authorization simply gives you access to the resource, but does not tell you who turned to it, and this is the problem you are facing. In order to authenticate your users as real users (or as close to them as possible), you will need to add a login service for your service - something like you are minimizing your own OAuth server or the like. Then you can decide who can access the resource, which in this case is your RESTful API :) If it is more than worth it, then the Tommy scheme is a good alternative :)
source share