ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto

oauth fix to separate netlify dev and --live mode

Changed files
+18 -5
netlify
functions
+18 -5
netlify/functions/oauth-config.ts
··· 1 1 export function getOAuthConfig() { 2 + // Check if we have a public URL (production or --live mode) 3 + const baseUrl = process.env.URL || process.env.DEPLOY_URL || process.env.DEPLOY_PRIME_URL; 4 + 2 5 // Development: loopback client for local dev 3 - const isDev = process.env.NODE_ENV === 'development' || process.env.NETLIFY_DEV === 'true'; 6 + // Check if we're running on localhost (true local dev) 7 + const isLocalhost = !baseUrl || 8 + baseUrl.includes('localhost') || 9 + baseUrl.includes('127.0.0.1') || 10 + baseUrl.startsWith('http://localhost') || 11 + baseUrl.startsWith('http://127.0.0.1'); 12 + 13 + // Use loopback for localhost, production for everything else 14 + const isDev = isLocalhost; 4 15 5 16 if (isDev) { 6 17 const port = process.env.PORT || '8888'; ··· 10 21 ['redirect_uri', `http://127.0.0.1:${port}/.netlify/functions/oauth-callback`], 11 22 ['scope', 'atproto transition:generic'], 12 23 ])}`; 24 + 25 + console.log('Using loopback OAuth for local development'); 26 + console.log('Access your app at: http://127.0.0.1:' + port); 13 27 14 28 return { 15 29 clientId: clientId, ··· 20 34 } 21 35 22 36 // Production: discoverable client logic 23 - const baseUrl = process.env.URL || process.env.DEPLOY_PRIME_URL; 24 - 25 - if (process.env.NETLIFY && !process.env.URL) { 26 - throw new Error('process.env.URL is required in Netlify environment'); 37 + if (!baseUrl) { 38 + throw new Error('No public URL available'); 27 39 } 28 40 41 + console.log('Using confidential OAuth client for production'); 29 42 console.log('OAuth Config URLs:', { 30 43 DEPLOY_PRIME_URL: process.env.DEPLOY_PRIME_URL, 31 44 URL: process.env.URL,