C
C#14mo ago
SwaggerLife

❔ 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
x0rld14mo ago
how do you know if it's the android or ios who contact you ?
SwaggerLife
SwaggerLife14mo 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
x0rld14mo ago
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
SwaggerLife
SwaggerLife14mo ago
Yeah it wouldn't be sufficient. Keep in mind that the apps will be publicly available to any user.
x0rld
x0rld14mo ago
they still would have to decompile the app to reverse it 🤔
SwaggerLife
SwaggerLife14mo 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
x0rld14mo ago
yeah they still can use a proxy to check what's in the request
SwaggerLife
SwaggerLife14mo ago
That too, damn. I forgot about that.
Henkypenky
Henkypenky14mo ago
how do you hand this tokens?
SwaggerLife
SwaggerLife14mo ago
@Henkypenky They provide their credentials and I generate a jwt. Through an http POST request.
Henkypenky
Henkypenky14mo ago
good, you can probably record some unique identifier of that user, and use that in the requests to come
Accord
Accord14mo 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.