Explorar o código

debug: add client secret preview logging for HMAC troubleshooting #96

Claude hai 5 meses
pai
achega
81f98d1cc2
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      supabase/functions/oauth-shoprenter-callback/index.ts

+ 7 - 0
supabase/functions/oauth-shoprenter-callback/index.ts

@@ -154,6 +154,13 @@ serve(wrapHandler('oauth-shoprenter-callback', async (req) => {
     // Log which environment variables are being used
     console.log(`[ShopRenter] Using client ID from: ${Deno.env.get('SHOPRENTER_APP_CLIENT_ID') ? 'SHOPRENTER_APP_CLIENT_ID' : 'SHOPRENTER_CLIENT_ID'}`)
     console.log(`[ShopRenter] Using client secret from: ${Deno.env.get('SHOPRENTER_APP_CLIENT_SECRET') ? 'SHOPRENTER_APP_CLIENT_SECRET' : 'SHOPRENTER_CLIENT_SECRET'}`)
+    // Log first 4 and last 4 chars of secret for debugging (safe to expose)
+    if (shoprenterClientSecret) {
+      const secretPreview = shoprenterClientSecret.length > 8
+        ? `${shoprenterClientSecret.substring(0, 4)}...${shoprenterClientSecret.substring(shoprenterClientSecret.length - 4)}`
+        : '(too short)';
+      console.log(`[ShopRenter] Client secret preview: ${secretPreview} (length: ${shoprenterClientSecret.length})`)
+    }
 
     if (!shoprenterClientId || !shoprenterClientSecret) {
       console.error('ShopRenter client credentials not configured. Set either SHOPRENTER_APP_CLIENT_ID/SECRET or SHOPRENTER_CLIENT_ID/SECRET')