vouch / vouch-proxy

an SSO and OAuth / OIDC login solution for Nginx using the auth_request module
MIT License
2.88k stars 326 forks source link

How to fix "oauth.callback_url must be within a configured domains where the cookie will be sent" #527

Closed aodhan-domhnaill closed 1 year ago

aodhan-domhnaill commented 1 year ago

I want a simple localhost proxy running with Hydra. My docker-compose is mostly copied from https://github.com/vouch/vouch-proxy/issues/288,

  vouch:
    image: quay.io/vouch/vouch-proxy
    environment:
      - OAUTH_PROVIDER=oidc
      - OAUTH_CLIENT_ID=changeme
      - OAUTH_CLIENT_SECRET=changeme
      - OAUTH_AUTH_URL=http://localhost:3000/oauth2/auth
      - OAUTH_TOKEN_URL=http://localhost:3000/oauth2/token
      - OAUTH_USER_INFO_URL=http://localhost:3000/userinfo
      - OAUTH_END_SESSION_ENDPOINT=http://localhost:3000/oauth2/sessions/logout
      - OAUTH_scopes=openid,email,profile
      # Be sure to create your Ory Hydra oAuth2.0 client with the below URL as the --callbacks parameter.
      # Note that you will get errors if your client has multiple callback URLs registered and uses the 'pairwise' subject identifier.
      - OAUTH_CALLBACK_URL=http://localhost:3000/auth=value

I see that I require DNS.

https://github.com/vouch/vouch-proxy/blob/a676feb8951e1c891289719ea49001180d334d52/config/config.yml_example#L48

Is there a way to resolve this for a simple local version?

vouch_1          | {"level":"info","ts":1679675695.5645263,"msg":"setting LogLevel to info"}
vouch_1          | {"level":"info","ts":1679675695.564551,"msg":"configuring oidc OAuth with Endpoint http://localhost:3000/oauth2/auth"}
vouch_1          | {"level":"warn","ts":1679675695.5645716,"msg":"Configuration Warning: for 'oauth.provider: oidc', 'oauth.scopes' should usually contain: -openid -email -profile"}
vouch_1          | {"level":"fatal","ts":1679675695.5646045,"msg":"configuration error: oauth.callback_url (http://localhost:3000/auth=value) must be within a configured domains where the cookie will be set: either `vouch.domains` [] or `vouch.cookie.domain` "}
bnfinet commented 1 year ago

@aodhan-domhnaill you'll need to add additional VP related configuration either using environmental variables or by mapping in a configuration file

Please consult the README