diegosouzapw/OmniRoute · error
Token refresh failed: ${error}
Error message
Token refresh failed: ${error} What it means
Error "Token refresh failed: ${error}" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/lib/oauth/services/kiro.ts:210
const { authMethod, clientId, clientSecret, region } = providerSpecificData;
// Enterprise / Microsoft Entra "Your organization" (external_idp) login: refresh with a
// standard public-client OAuth2 refresh_token grant against the org IdP's tokenEndpoint
// (form-encoded client_id + refresh_token + scope, no client_secret). The AWS SSO OIDC and
// Kiro social endpoints cannot refresh these tokens.
if (isExternalIdpAuthMethod(authMethod)) {
const refreshRequest = buildExternalIdpRefreshParams(refreshToken, providerSpecificData);
const response = await fetch(refreshRequest.tokenEndpoint, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json",
},
body: refreshRequest.body,
});
if (!response.ok) {
const error = await response.text();
throw new Error(`Token refresh failed: ${error}`);
}
const data = await response.json();
return {
accessToken: data.access_token,
refreshToken: data.refresh_token || refreshToken,
expiresIn: data.expires_in || 3600,
};
}
// AWS SSO OIDC refresh (Builder ID or IDC).
// Imported social tokens (authMethod === "imported") have a registered clientId/clientSecret
// but a Kiro-social refresh token the OIDC client can't refresh — use the social path (#2467).
if (clientId && clientSecret && authMethod !== "imported") {
const resolvedRegion = region || "us-east-1";
assertValidAwsRegion(resolvedRegion);
const endpoint = `https://oidc.${resolvedRegion}.amazonaws.com/token`;
const response = await fetch(endpoint, {View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/lib/oauth/services/kiro.ts:210 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/bafec360a60107c4.
Report an issue: GitHub.