-
Notifications
You must be signed in to change notification settings - Fork 947
feat(desktop): add Anthropic OAuth re-auth flow in model picker #1739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Kitenite
merged 4 commits into
superset-sh:main
from
Kitenite:kitenite/model-selector-auth
Feb 24, 2026
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
04d3eed
feat(desktop): add anthropic oauth re-auth flow in model picker
Kitenite 0874137
refactor(desktop): split model picker oauth and provider rendering
Kitenite 8ae2b15
fix(auth): validate anthropic oauth state and enforce token expiry
Kitenite 55cbc5b
fix(auth): harden oauth completion and browser open handling
Kitenite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
140 changes: 140 additions & 0 deletions
140
...Interface/components/ModelPicker/components/AnthropicOAuthDialog/AnthropicOAuthDialog.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| import { Button } from "@superset/ui/button"; | ||
| import { | ||
| Dialog, | ||
| DialogContent, | ||
| DialogDescription, | ||
| DialogFooter, | ||
| DialogHeader, | ||
| DialogTitle, | ||
| } from "@superset/ui/dialog"; | ||
| import { | ||
| InputGroup, | ||
| InputGroupAddon, | ||
| InputGroupButton, | ||
| InputGroupInput, | ||
| } from "@superset/ui/input-group"; | ||
| import { Label } from "@superset/ui/label"; | ||
| import { LuCopy, LuExternalLink } from "react-icons/lu"; | ||
|
|
||
| interface AnthropicOAuthDialogProps { | ||
| open: boolean; | ||
| authUrl: string | null; | ||
| code: string; | ||
| errorMessage: string | null; | ||
| isPending: boolean; | ||
| onOpenChange: (open: boolean) => void; | ||
| onCodeChange: (value: string) => void; | ||
| onOpenAuthUrl: () => void; | ||
| onCopyAuthUrl: () => void; | ||
| onPasteCode: () => void; | ||
| onSubmit: () => void; | ||
| } | ||
|
|
||
| export function AnthropicOAuthDialog({ | ||
| open, | ||
| authUrl, | ||
| code, | ||
| errorMessage, | ||
| isPending, | ||
| onOpenChange, | ||
| onCodeChange, | ||
| onOpenAuthUrl, | ||
| onCopyAuthUrl, | ||
| onPasteCode, | ||
| onSubmit, | ||
| }: AnthropicOAuthDialogProps) { | ||
| return ( | ||
| <Dialog open={open} onOpenChange={onOpenChange}> | ||
| <DialogContent className="max-w-[calc(100vw-2rem)] overflow-hidden sm:max-w-lg"> | ||
| <DialogHeader> | ||
| <DialogTitle>Connect Anthropic</DialogTitle> | ||
| <DialogDescription> | ||
| Open Anthropic OAuth in your browser, approve access, then paste the | ||
| code here. | ||
| </DialogDescription> | ||
| </DialogHeader> | ||
|
|
||
| <div className="min-w-0 space-y-4"> | ||
| <InputGroup className="max-w-full overflow-hidden border-border/70 bg-muted/30"> | ||
| <InputGroupInput | ||
| readOnly | ||
| value={authUrl ?? "OAuth URL not ready"} | ||
| className="text-muted-foreground h-9 text-xs" | ||
| /> | ||
| <InputGroupAddon align="inline-end" className="gap-1 pr-1"> | ||
| <InputGroupButton | ||
| size="icon-xs" | ||
| variant="ghost" | ||
| aria-label="Copy OAuth URL" | ||
| title="Copy OAuth URL" | ||
| onClick={onCopyAuthUrl} | ||
| disabled={!authUrl} | ||
| > | ||
| <LuCopy className="size-3.5" /> | ||
| </InputGroupButton> | ||
| <InputGroupButton | ||
| size="icon-xs" | ||
| variant="ghost" | ||
| aria-label="Open OAuth URL" | ||
| title="Open OAuth URL" | ||
| onClick={onOpenAuthUrl} | ||
| disabled={!authUrl} | ||
| > | ||
| <LuExternalLink className="size-3.5" /> | ||
| </InputGroupButton> | ||
| </InputGroupAddon> | ||
| </InputGroup> | ||
|
|
||
| <div className="min-w-0 space-y-2"> | ||
| <Label htmlFor="anthropic-oauth-code">Authorization code</Label> | ||
| <InputGroup> | ||
| <InputGroupInput | ||
| id="anthropic-oauth-code" | ||
| placeholder="Paste code or code#state" | ||
| value={code} | ||
| onChange={(event) => onCodeChange(event.target.value)} | ||
| disabled={isPending} | ||
| className="h-11 font-mono" | ||
| /> | ||
| <InputGroupAddon align="inline-end" className="pr-1"> | ||
| <InputGroupButton | ||
| size="xs" | ||
| variant="outline" | ||
| onClick={onPasteCode} | ||
| disabled={isPending} | ||
| > | ||
| Paste | ||
| </InputGroupButton> | ||
| </InputGroupAddon> | ||
| </InputGroup> | ||
| <p className="text-muted-foreground text-xs"> | ||
| Accepts either `code` or `code#state`. | ||
| </p> | ||
| </div> | ||
|
|
||
| {errorMessage ? ( | ||
| <p className="text-destructive text-sm">{errorMessage}</p> | ||
| ) : null} | ||
| </div> | ||
|
|
||
| <DialogFooter> | ||
| <Button | ||
| type="button" | ||
| variant="outline" | ||
| onClick={() => onOpenChange(false)} | ||
| disabled={isPending} | ||
| > | ||
| Back | ||
| </Button> | ||
| <Button | ||
| type="button" | ||
| onClick={onSubmit} | ||
| disabled={isPending || !code} | ||
| > | ||
| {isPending ? "Connecting..." : "Connect"} | ||
| </Button> | ||
| </DialogFooter> | ||
| </DialogContent> | ||
| </Dialog> | ||
| ); | ||
| } | ||
1 change: 1 addition & 0 deletions
1
...ew/ChatPane/ChatInterface/components/ModelPicker/components/AnthropicOAuthDialog/index.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { AnthropicOAuthDialog } from "./AnthropicOAuthDialog"; |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks render as literal characters in HTML — use
<code>elements instead.The markdown-style backticks won't render as inline code in JSX. They'll appear as literal
`characters in the UI.Proposed fix
🤖 Prompt for AI Agents