DEV Community

Cover image for πŸ’Ž ANN: oauth2 v2.0.15 & v2.0.16 w/ full E2E example
Peter H. Boling
Peter H. Boling

Posted on

πŸ’Ž ANN: oauth2 v2.0.15 & v2.0.16 w/ full E2E example

Complete E2E single file script against navikt/mock-oauth2-server

NOTE: The mock test server was added to source in oauth v2.0.11, and has now been upgraded to the latest version of mock-oauth2-server. The mock test server is not in the packaged gem.

docker compose -f docker-compose-ssl.yml up -d --wait
ruby examples/e2e.rb
# If your machine is slow or Docker pulls are cold, increase the wait:
E2E_WAIT_TIMEOUT=120 ruby examples/e2e.rb
# The mock server serves HTTP on 8080; the example points to http://localhost:8080 by default.
Enter fullscreen mode Exit fullscreen mode

The output should be something like this:

➜  ruby examples/e2e.rb
Access token (truncated): eyJraWQiOiJkZWZhdWx0...
userinfo status: 200
userinfo body: {"sub" => "demo-sub", "aud" => ["demo-aud"], "nbf" => 1757816758000, "iss" => "http://localhost:8080/default", "exp" => 1757820358000, "iat" => 1757816758000, "jti" => "d63b97a7-ebe5-4dea-93e6-d542caba6104"}
E2E complete
Enter fullscreen mode Exit fullscreen mode

Make sure to shut down the mock server when you are done:

docker compose -f docker-compose-ssl.yml down
Enter fullscreen mode Exit fullscreen mode

Troubleshooting: validate connectivity to the mock server

  • Check container status and port mapping:
    • docker compose -f docker-compose-ssl.yml ps
  • From the host, try the discovery URL directly (this is what the example uses by default):
  • From inside the container (to distinguish container vs host networking):
  • Simple TCP probe from the host:
    • nc -vz localhost 8080 # or: ruby -rsocket -e 'TCPSocket.new("localhost",8080).close; puts "tcp ok"'
  • Inspect which host port 8080 is bound to (should be 8080):
    • docker inspect -f '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' oauth2-mock-oauth2-server-1
  • Look at server logs for readiness/errors:
    • docker logs -n 200 oauth2-mock-oauth2-server-1
  • On Linux, ensure nothing else is bound to 8080 and that firewall/SELinux aren’t blocking:
    • ss -ltnp | grep :8080

Notes

  • Discovery URL pattern is: http://localhost:8080//.well-known/openid-configuration, where defaults to "default".
  • You can change these with env vars when running the example:

See the full changelogs after a word from (or is it for?) my sponsor (you!).

Support & Funding Info

I am a full-time FLOSS maintainer. If you find my work valuable I ask that you become a sponsor. Every dollar helps!

πŸ₯° Support FLOSS work πŸ₯° Get access "Sponsors" channel on Galtzo FLOSS Discord πŸ‘‡οΈ Live Chat on Discord
OpenCollective Backers OpenCollective Sponsors Buy me a coffee Donate at ko-fi.com Donate on PayPal Donate on Polar Sponsor Me on Github Liberapay Goal Progress

2.0.16 - 2025-09-14

  • TAG: v2.0.16
  • COVERAGE: 96.33% -- 394/409 lines in 14 files
  • BRANCH COVERAGE: 86.49% -- 64/74 branches in 14 files
  • 90.48% documented ### Added
  • gh!680 - E2E example using mock test server added in v2.0.11 by @pboling
    • mock-oauth2-server upgraded to v2.3.0
    • https://github.com/navikt/mock-oauth2-server
    • docker compose -f docker-compose-ssl.yml up -d --wait
    • ruby examples/e2e.rb
    • docker compose -f docker-compose-ssl.yml down
    • mock server readiness wait is 90s
    • override via E2E_WAIT_TIMEOUT
  • gh!676, gh!679 - Apache SkyWalking Eyes dependency license check by @pboling

    Changed

  • gh!678 - Many improvements to make CI more resilient (past/future proof) by @pboling
  • gh!681 - Upgrade to kettle-dev v1.1.19

2.0.15 - 2025-09-08

  • TAG: v2.0.15
  • COVERAGE: 100.00% -- 519/519 lines in 14 files
  • BRANCH COVERAGE: 100.00% -- 174/174 branches in 14 files
  • 90.48% documented ### Added
  • gh!671 - Complete documentation example for Instagram by @pboling
  • .env.local.example for contributor happiness
  • note lack of builds for JRuby 9.2, 9.3 & Truffleruby 22.3, 23.0
  • gh!670 - AccessToken: verb-dependent token transmission mode by @mrj
    • e.g., Instagram GET=:query, POST/DELETE=:header ### Changed
  • gh!669 - Upgrade to kettle-dev v1.1.9 by @pboling

    Fixed

  • Remove accidentally duplicated lines, and fix typos in CHANGELOG.md
  • point badge to the correct workflow for Ruby 2.3 (caboose.yml)

Photo (cropped) by Zoha Gohar on Unsplash

Top comments (0)