Skip to content

feat(auth): theme and customize OAuth callback pages#335

Merged
danielgtaylor merged 1 commit into
mainfrom
oauth-callback-pages
May 27, 2026
Merged

feat(auth): theme and customize OAuth callback pages#335
danielgtaylor merged 1 commit into
mainfrom
oauth-callback-pages

Conversation

@danielgtaylor
Copy link
Copy Markdown
Collaborator

Summary

  • Restore animated OAuth authorization-code callback success and failure pages from v1.
  • Use the active Restish theme's status_2xx and status_error colors for the default callback backgrounds.
  • Add optional callback_success_html and callback_error_html auth params for branded callback pages; error templates support $ERROR, $TITLE, and $DETAILS with escaped substitutions.
  • Keep callback HTML params local to Restish so they are not forwarded to OAuth authorization, device authorization, or token endpoints.
  • Document the themed defaults and custom HTML params in the OAuth guide/reference.

Credit: adapts the custom callback HTML idea from #330 by @davidlwg for the v2 OAuth implementation.

Tests

  • env GOCACHE=/tmp/restish-gocache go test ./internal/auth -count=1
  • env GOCACHE=/tmp/restish-gocache go test ./...

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores branded, animated OAuth authorization-code browser callback pages and adds per-profile customization, integrating with Restish's active theme for default colors.

Changes:

  • Adds animated success/failure callback pages with status_2xx/status_error theme-driven background colors and HTML-escaped title/detail.
  • Adds callback_success_html / callback_error_html auth params (with $ERROR/$TITLE/$DETAILS escaped substitution) reserved from authorize/token/device endpoints.
  • Documents the new behavior in the OAuth guide and auth reference, and adds tests for theme color access, callback rendering, and non-forwarding of HTML params.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/auth/oauth_authcode.go Adds callback color/HTML fields, themed/animated callback pages, template rendering, and reserves new params from authorize URL.
internal/auth/oauth_authcode_test.go Updates existing callback assertions and adds tests for escaping, color fallback, custom HTML fields/params, and non-forwarding.
internal/auth/oauth_common.go Reserves callback_success_html/callback_error_html from token-endpoint extra params.
internal/auth/oauth_common_test.go Verifies new HTML params aren't forwarded to token endpoint.
internal/auth/oauth_device_code.go Reserves new HTML params from device-authorization extras.
internal/cli/auth.go Wires active theme colors into the authorization-code handler.
internal/cli/auth_internal_test.go Tests theme-color wiring into the handler.
internal/output/style.go Adds ThemeTokenColor to expose token foreground colors.
internal/output/style_test.go Tests ThemeTokenColor for known/unknown tokens.
site/content/en/docs/guides/oauth.md Documents callback HTML customization with example.
site/content/en/docs/reference/auth.md Lists new optional callback HTML params for oauth-authorization-code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@danielgtaylor danielgtaylor merged commit 37d88e8 into main May 27, 2026
8 checks passed
@danielgtaylor danielgtaylor deleted the oauth-callback-pages branch May 27, 2026 20:08
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.

2 participants