Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export const OpenAIOAuthPlugin: Plugin = async ({ client }: PluginInput) => {
validate: (input: string): string | undefined => {
const parsed = parseAuthorizationInput(input);
if (!parsed.code) {
return "No authorization code found. Paste the full callback URL (e.g., http://localhost:1455/auth/callback?code=...)";
return `No authorization code found. Paste the full callback URL (e.g., ${REDIRECT_URI}?code=...)`;
}
if (!parsed.state) {
return "Missing OAuth state. Paste the full callback URL including both code and state parameters.";
Expand Down
6 changes: 5 additions & 1 deletion lib/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { safeParseOAuthTokenResponse } from "../schemas.js";
export const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
export const AUTHORIZE_URL = "https://auth.openai.com/oauth/authorize";
export const TOKEN_URL = "https://auth.openai.com/oauth/token";
export const REDIRECT_URI = "http://localhost:1455/auth/callback";
export const REDIRECT_URI = "http://127.0.0.1:1455/auth/callback";
export const SCOPE = "openid profile email offline_access";

/**
Expand Down Expand Up @@ -44,6 +44,10 @@ export function parseAuthorizationInput(input: string): ParsedAuthInput {
if (code || state) {
return { code, state };
}

// Input is a valid URL but does not contain OAuth parameters.
// Do not reinterpret URL fragments as "code#state" fallback syntax.
return {};
} catch {
// Invalid URL, try other parsing methods
}
Expand Down
Loading