From ffe5cba399ebd1b5f4c1cf90ee703063cc5074d5 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 18 Oct 2025 21:49:37 -0500 Subject: [PATCH] Fix Netlify OAuth --- src/hooks/useNetlifyOAuth.ts | 4 ++-- src/hooks/useOAuth.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hooks/useNetlifyOAuth.ts b/src/hooks/useNetlifyOAuth.ts index df0e16f9..ca8790a6 100644 --- a/src/hooks/useNetlifyOAuth.ts +++ b/src/hooks/useNetlifyOAuth.ts @@ -26,9 +26,9 @@ export function useNetlifyOAuth() { clientSecret: import.meta.env.VITE_NETLIFY_OAUTH_CLIENT_SECRET || '', authorizeUrl: 'https://app.netlify.com/authorize', tokenUrl: 'https://api.netlify.com/oauth/token', - scope: 'deploy', + // Netlify doesn't use scope parameter - permissions are configured in the OAuth app settings redirectUri: window.location.origin + '/oauth/netlify', - usePKCE: false, // Netlify doesn't require PKCE + usePKCE: false, // Netlify doesn't support PKCE getUserInfo: async (accessToken: string, corsProxy: string) => { const userUrl = proxyUrl(corsProxy, 'https://api.netlify.com/api/v1/user'); const userResponse = await fetch(userUrl, { diff --git a/src/hooks/useOAuth.ts b/src/hooks/useOAuth.ts index 6de790db..de6cb72b 100644 --- a/src/hooks/useOAuth.ts +++ b/src/hooks/useOAuth.ts @@ -8,7 +8,7 @@ export interface OAuthConfig { clientSecret: string; authorizeUrl: string; tokenUrl: string; - scope: string; + scope?: string; // Optional - some providers don't use scopes redirectUri: string; usePKCE?: boolean; getUserInfo?: (accessToken: string, corsProxy: string) => Promise<{ @@ -93,11 +93,15 @@ export function useOAuth(config: OAuthConfig) { const params = new URLSearchParams({ client_id: config.clientId, redirect_uri: config.redirectUri, - scope: config.scope, state: state, response_type: 'code', }); + // Add scope if provided (some providers don't use scopes) + if (config.scope) { + params.append('scope', config.scope); + } + // Add PKCE parameters if enabled if (config.usePKCE) { const codeVerifier = generateCodeVerifier();