Skip to content

test: cover the refresh_token grant end-to-end#65

Open
xrendan wants to merge 1 commit into
mainfrom
test/oauth-refresh-grant
Open

test: cover the refresh_token grant end-to-end#65
xrendan wants to merge 1 commit into
mainfrom
test/oauth-refresh-grant

Conversation

@xrendan

@xrendan xrendan commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Adds integration coverage for the OAuth refresh_token grant — the flow TradingPost's silent-refresh middleware (TradingPost #22) relies on. The provider-side capability (use_refresh_token) shipped in #64; this backfills the missing automated coverage.

Tests added (test/integration/oauth_flow_test.rb)

  1. renews an access token via the refresh_token grant — full round-trip:
    • authorize → exchange code for token (capture refresh_token)
    • grant_type=refresh_token → assert a new, different access token + refresh token
    • the renewed access token authorizes GET /api/v1/me
    • the superseded access token is revoked (/me → 401)
  2. rejects an invalid refresh token400 invalid_grant.

Testing

bin/rails test test/integration/oauth_flow_test.rb → 15 runs, 0 failures. Rubocop clean.

Exercises the flow TradingPost's silent-refresh middleware depends on:
code -> token (capture refresh token) -> refresh_token grant -> verify the
renewed access token authorizes /me and the superseded token is revoked.
Plus an invalid-refresh-token rejection case (400 invalid_grant).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant