mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 06:02:14 +03:00
fix: use public callbacks for remote Google OAuth with custom creds
This commit is contained in:
@@ -18,8 +18,10 @@ const providersModule = await import("../../src/lib/oauth/providers/index.ts");
|
||||
const oauthModule = await import("../../src/lib/oauth/constants/oauth.ts");
|
||||
const registryModule = await import("../../open-sse/config/providerRegistry.ts");
|
||||
const antigravityHeadersModule = await import("../../open-sse/services/antigravityHeaders.ts");
|
||||
const oauthHelpersModule = await import("../../src/lib/oauth/providers.ts");
|
||||
|
||||
const PROVIDERS = providersModule.default;
|
||||
const { resolveBrowserOAuthRedirectUri } = oauthHelpersModule;
|
||||
const {
|
||||
ANTIGRAVITY_CONFIG,
|
||||
CLAUDE_CONFIG,
|
||||
@@ -316,6 +318,44 @@ test("browser-based providers expose buildAuthUrl and return provider-specific a
|
||||
assert.equal(clineUrl.origin, "https://api.cline.bot");
|
||||
});
|
||||
|
||||
test("custom Google OAuth credentials switch Antigravity remote callbacks to NEXT_PUBLIC_BASE_URL", () => {
|
||||
const redirectUri = resolveBrowserOAuthRedirectUri(
|
||||
"antigravity",
|
||||
"http://localhost:20128/callback",
|
||||
{
|
||||
NEXT_PUBLIC_BASE_URL: "https://omniroute.example.com/",
|
||||
ANTIGRAVITY_OAUTH_CLIENT_ID: "custom-antigravity.apps.googleusercontent.com",
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(redirectUri, "https://omniroute.example.com/callback");
|
||||
});
|
||||
|
||||
test("custom Google OAuth credentials switch Gemini remote callbacks to OMNIROUTE_PUBLIC_BASE_URL", () => {
|
||||
const redirectUri = resolveBrowserOAuthRedirectUri(
|
||||
"gemini-cli",
|
||||
"http://127.0.0.1:20128/callback",
|
||||
{
|
||||
OMNIROUTE_PUBLIC_BASE_URL: "https://omniroute.example.com",
|
||||
GEMINI_CLI_OAUTH_CLIENT_ID: "custom-gemini.apps.googleusercontent.com",
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(redirectUri, "https://omniroute.example.com/callback");
|
||||
});
|
||||
|
||||
test("Google OAuth callbacks stay on localhost when no custom credentials are configured", () => {
|
||||
const redirectUri = resolveBrowserOAuthRedirectUri(
|
||||
"antigravity",
|
||||
"http://localhost:20128/callback",
|
||||
{
|
||||
NEXT_PUBLIC_BASE_URL: "https://omniroute.example.com",
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(redirectUri, "http://localhost:20128/callback");
|
||||
});
|
||||
|
||||
test("device and import-token providers expose the flow-specific fields expected by their configs", () => {
|
||||
const deviceProviders = ["qwen", "kimi-coding", "github", "kiro", "amazon-q", "kilocode"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user