mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-19 05:32:19 +03:00
fix(oauth): treat Kiro social poll status as alias of error for pending states (#10620)
Kiro's device poll endpoint reports progress in a `status` field (e.g. `authorization_pending`), but `classifyKiroSocialPoll()` only inspected `data.error`. This caused every pre-authorization poll to fall through to the terminal `invalid_token_response` error, making social login impossible for Kiro AI and Amazon Q via Google/GitHub. Changes: - Add `status` field to `KiroSocialPollData` type - Update `classifyKiroSocialPoll()` to check `data.status` as fallback for `data.error` when detecting pending states - Add tests covering `status`-based pending detection and precedence Closes #10618
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
export type KiroSocialPollData = {
|
||||
error?: unknown;
|
||||
/** Kiro reports poll progress here (e.g. "authorization_pending"), not in `error`. */
|
||||
status?: unknown;
|
||||
accessToken?: unknown;
|
||||
refreshToken?: unknown;
|
||||
};
|
||||
@@ -26,8 +28,9 @@ export function classifyKiroSocialPoll(
|
||||
responseStatus: number,
|
||||
data: KiroSocialPollData
|
||||
): KiroSocialPollOutcome {
|
||||
if (data.error === "authorization_pending" || data.error === "slow_down") {
|
||||
return { kind: "pending", error: data.error };
|
||||
const progress = data.error ?? data.status;
|
||||
if (progress === "authorization_pending" || progress === "slow_down") {
|
||||
return { kind: "pending", error: progress as "authorization_pending" | "slow_down" };
|
||||
}
|
||||
|
||||
if (!responseOk || data.error) {
|
||||
|
||||
Reference in New Issue
Block a user