Accept Slack bot and user OAuth grants

Merged
RH
2mo ago
+356-3

Summary

Slack sign-in can return HTTP 200 but fail to save a connection because Slack uses bot and user token types. Normalize successful Slack grants, including nested user grants, for code exchange and refresh while retaining token validation.

Verification

  • The Slack emulator browser scenario fails before the fix and passes on this isolated branch.
  • SDK OAuth tests: 96 passed, covering exchange and refresh, mixed bot/user grants, preservation of standard bearer responses, and rejection of unsupported token types.
  • SDK and E2E type checks, scoped lint, and formatting passed.

Response formats were checked against Slack’s OAuth documentation and token rotation guide. Live Slack bot and user-only consent saved connections on this PR preview. Both grants passed authenticated identity calls and two successive token refreshes, including reuse of the rotated refresh token. Refresh was triggered by advancing only each disposable connection's stored expiry; requests and responses used real Slack endpoints. All current PR checks passed after rerunning a transient OpenAPI timeout failure. Live account evidence remains private.

Recordings

Synthetic test accounts only. The before recording ends after the error appears; the test then fails while waiting for a saved connection.

Before

https://github.com/user-attachments/assets/2fa23118-c67b-4c3f-b497-5f0112733653

After

https://github.com/user-attachments/assets/e2da5b59-dfae-4348-99ed-b6497208cd06