#Topic guide for Oauth within dagger

1 messages · Page 1 of 1 (latest)

placid harness
#

I'm setting up end-to-end testing within dagger, and it would be best (IMO) to have auth in the mix. We use AWS Cognito Oauth. A minimal look at the stack:

  • Traefik
    • Frontend
    • Backend
      In my dagger end_to_end function I initialize my stack and bind it to the test container.

I'm confident in the stack, when I run it outright as a service I'm able to do auth and the whole thing works against localhost. However, I've hit a snag when running the end-to-end tests, namely the callback URL for testing Oauth must be of the form http://localhost/... (else https is required).

I've tried binding traefik to the test container assigning the alias localhost: test_container = test_container.with_service_binding("localhost", traefik_service). However, whenever tests try to touch that url (http://localhost/mypath/) it results in a net::ERR_CONNECTION_REFUSED.

Is there a "dagger" way to test with oauth in the loop using localhost as the callback URL?

arctic karma
#

given that you're trying to run e2e tests via dagger call which doesn't involve exposing services, if going through the Oauth flow is a must, what other users have been doing to enable this is running cloudflare tunnels or tailscale funnel so that way you can use https:// callbacks in your app and they'll get redirected to whatever container you need in your Dagger pipeline

#

LMK if that makes sense 🙏

placid harness
#

I ended up using socat to make pretend that my proxy service is actually localhost. Seems to work fine. On Monday I can post a more complete example. (I still need to follow up on that cache pruning thread from before)

#

I've finally gotten my whole test suite running in dagger (and passing)!

arctic karma
placid harness
#

I'm running it straight to the background just before I run the playwright tests using a sh -c "socat ... & npmx ...". It looks filthy and I hate it, but my sprint task wasn't to make it beautiful, it was to make it functional.

arctic karma
#

I guess I'm not really understanding if socat runs within Dagger or not