feat(auth): theme and customize OAuth callback pages#335
Merged
Conversation
There was a problem hiding this comment.
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_errortheme-driven background colors and HTML-escaped title/detail. - Adds
callback_success_html/callback_error_htmlauth params (with$ERROR/$TITLE/$DETAILSescaped 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
status_2xxandstatus_errorcolors for the default callback backgrounds.callback_success_htmlandcallback_error_htmlauth params for branded callback pages; error templates support$ERROR,$TITLE, and$DETAILSwith escaped substitutions.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=1env GOCACHE=/tmp/restish-gocache go test ./...