Hello.
I’m facing problem with local development stack when all the services run in docker with docker-compose
The services are bellow:
- hydra
- consent-login handler (go)
- OAuth2 client (go)
- resource server (not relevant for question)
My problem with OAuth2 client.
I’m using “github.com/coreos/go-oidc” package to perform Authorization Code flow.
To initialize the oidc config this package provide oidc.NewProvider method which get the issuer url as parameter. In local development environment it is something like 127.0.0.1:4444
Everything is working fine if i run the client application on the local computer but from docker container the address 127.0.0.1 cannot be used to access the Hydra Public endpoint, and provider cannot download all .well-known data and failed to initialize itself.
In case of dockerized environment i the client app have to use internal address of hydra public api, but in this case all urls in client will point to internal address of public api, which is not accessible in browser. If the issuer of oidc.Provider will nor match to URLS_SELF_ISSUER of hydra, the provider also will fail to initialize.
I tried to run the oauth clien in docker with network_mode=host, in this case the 127.0.0.1 inside container will point to localhost of the machine, but in this case my oauth2 client not accessible from the browser.
I’m really confused with this setup.
I also understand that if hydra public api will be on real host, i will not be an issue, but how to start the local development stack in docker?