Ensure IssuerUri
is set to an explicit constant. We had similar issues with accessing Identity Server instance by the IP/hostname and resolved it this way:
services.AddIdentityServer(x =>
{
x.IssuerUri = "my_auth";
})
P.S. Why don’t you unify the authority URL to hostname:5000
? Yes, it is possible for Client and API both call the same URL hostname:5000
if:
- 5000 port is exposed (I see it’s OK)
- DNS is resolved inside the docker container.
- You have access to
hostname:5000
(check firewalls, network topology, etc.)
DNS is the most tricky part. If you have any trouble with it I recommend you try reaching Identity Server by its exposed IP instead of resolving hostname
.