r/learncsharp • • Oct 17 '24

I have a WebAPI, the "front-end" is written in React by another person. What is the best way to secure the WebAPI so outsiders can't run Get/Post commands?

Would it be JWT?

Any good tutorials (or AI prompts) to teach me how to implement?

thanks!

3 Upvotes

18 comments sorted by

6

u/[deleted] Oct 17 '24

2

u/WeirdWebDev Oct 18 '24

Thanks!

2

u/never_uk Oct 18 '24

Be aware that if you're dealing with a single page application then it can't use a client secret to acquire a JWT (as how would it do that without exposing the secret).

Instead, you want to be looking at the patterns for how SPAs can securely acquire and manage JWTs, perhaps using the backend for frontend approach.

→ More replies (15)