C
C#2y ago
V0FBU1VM

❔ How do I prevent access to a web server (web api application) from certain clients?

I have a web api running on azure. I also have 2 clients, 1 android app and 1 ios app. The client uses json web tokens to communicate with the server. This is how the authorization is done. In theory the json web tokens are acting like api keys to retrieve and mutate data. But if the user get's their hand on the token, they can make requests to the server from other application/services. Example: they could have their own website that is making calls to the web server with the jwt. Is there a way, I can only allow incoming requests from a certain specific client? In this case our (mobil apps).
12 Replies
x0rld 👻 🎃
how do you know if it's the android or ios who contact you ?
V0FBU1VM
V0FBU1VMOP2y ago
We only have 2 apps, one android and one ios. Right now we are not checking if the incoming request is coming from ios or android
x0rld 👻 🎃
ok you still could use a custom header in your request to make it more difficult to contact without doc but it's just a mitigation
V0FBU1VM
V0FBU1VMOP2y ago
Yeah it wouldn't be sufficient. Keep in mind that the apps will be publicly available to any user.
x0rld 👻 🎃
they still would have to decompile the app to reverse it 🤔
V0FBU1VM
V0FBU1VMOP2y ago
True that, but what if we have a web service. Like a website that is making calls. Then what? 😁 Boom the code is right there
x0rld 👻 🎃
yeah they still can use a proxy to check what's in the request
V0FBU1VM
V0FBU1VMOP2y ago
That too, damn. I forgot about that.
Henkypenky
Henkypenky2y ago
how do you hand this tokens?
V0FBU1VM
V0FBU1VMOP2y ago
@Henkypenky They provide their credentials and I generate a jwt. Through an http POST request.
Henkypenky
Henkypenky2y ago
good, you can probably record some unique identifier of that user, and use that in the requests to come
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server