How to test a secure API in Visual Studio
A typical way to test a secure API in Visual Studio is using bearer tokens, as JWT. In case you’re utilizing JWT, you may discover this site valuable to effortlessly look at JWT token substance. A typical situation when working with APIs security by bearer tokens is to need to accomplish something like this:
- Send credential to token server to get a token (with some restricted lifetime)
- Utilize the token from previous step in the request header
Failure to include a valid token will result in 401
You can test these using postman, you need to configure 2 request. You make the request to an endpoint like “/connect/token” to get the JWT token.
Then you can copy the token received from first request to second.