I am trying to get my integration tests working against a protected api endpoint. My test call the IDS connect/token endpoint and gets a valid token. When I use that to call the protected api I always get a failure with invalid_token. (the api is local to the IDS too)
If I manually debug the IDS and use postman to get a token and then manually set it and call the protected api with postman it works fine.
I suspect that the internals of the IDS validation code can't hit the discovery endpoint because it is spinning up its own HttpClient. I know that the WebApplicationFactory Client is a special implementation of HttpClient.
Is there a way that I can inject the WebApplicationFactory client into the IDS during configuration/startup so that it will work?
Or is there a way that I can make a fake authorization endpoint that just validates any token sent in the Auth header?
I would just like my integration tests to be able to work against the api, it would be great if it actually validated the token but if it can't I can fake it.
Thanks.