mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 23:02:10 +03:00
fix(kiro): minor OAuth social exchange tweaks (#3176)
Kiro social OAuth: optional targetProvider passthrough. Integrated into release/v3.8.10.
This commit is contained in:
@@ -11,6 +11,7 @@ import { KIRO_CONFIG } from "@/lib/oauth/constants/oauth";
|
||||
const socialExchangeSchema = z.object({
|
||||
deviceCode: z.string().min(1, "Missing deviceCode or provider"),
|
||||
provider: z.string().min(1, "Missing deviceCode or provider"),
|
||||
targetProvider: z.string().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -47,7 +48,7 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
try {
|
||||
const { deviceCode, provider } = validation.data;
|
||||
const { deviceCode, provider, targetProvider } = validation.data;
|
||||
|
||||
const response = await fetch(KIRO_CONFIG.socialDevicePollUrl, {
|
||||
method: "POST",
|
||||
@@ -84,7 +85,7 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
const connection: any = await createProviderConnection({
|
||||
provider: "kiro",
|
||||
provider: targetProvider || "kiro",
|
||||
authType: "oauth",
|
||||
accessToken: data.accessToken,
|
||||
refreshToken: data.refreshToken,
|
||||
|
||||
@@ -104,6 +104,7 @@ export default function KiroOAuthWrapper({
|
||||
<KiroSocialOAuthModal
|
||||
isOpen={isOpen}
|
||||
provider={socialProvider}
|
||||
targetProvider={oauthProviderId}
|
||||
providerLabel={providerLabel}
|
||||
onSuccess={handleSocialSuccess}
|
||||
onClose={handleBack}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { copyToClipboard } from "@/shared/utils/clipboard";
|
||||
type KiroSocialOAuthModalProps = {
|
||||
isOpen: boolean;
|
||||
provider: "google" | "github";
|
||||
targetProvider?: string;
|
||||
providerLabel?: string;
|
||||
onSuccess?: () => void;
|
||||
onClose: () => void;
|
||||
@@ -16,6 +17,7 @@ type KiroSocialOAuthModalProps = {
|
||||
export default function KiroSocialOAuthModal({
|
||||
isOpen,
|
||||
provider,
|
||||
targetProvider,
|
||||
providerLabel = "Kiro",
|
||||
onSuccess,
|
||||
onClose,
|
||||
@@ -51,7 +53,7 @@ export default function KiroSocialOAuthModal({
|
||||
const pollRes = await fetch("/api/oauth/kiro/social-exchange", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ deviceCode: data.deviceCode, provider }),
|
||||
body: JSON.stringify({ deviceCode: data.deviceCode, provider, targetProvider }),
|
||||
});
|
||||
const pollData = await pollRes.json();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user