Repository navigation
Expand file tree
/
Copy pathtest-supabase-auth.js
More file actions
46 lines (38 loc) · 1.87 KB
/
Copy pathtest-supabase-auth.js
File metadata and controls
46 lines (38 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const PROJECT_ID = 'calqfzajyidkdzbaswjp';
const BASE_URL = `https://${PROJECT_ID}.supabase.co/auth/v1`;
const ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNhbHFmemFqeWlka2R6YmFzd2pwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQyNzMwODMsImV4cCI6MjA3OTg0OTA4M30.ptXyUNCcAhGi9u2kVDHOxSBvQv0W72S5HHqkIFXQS08';
const PROVIDERS = ['github', 'google', 'discord', 'apple'];
async function runDiagnostics() {
console.log(`\n🚀 Supabase Auth Diagnostics for Project: ${PROJECT_ID}\n`);
for (const provider of PROVIDERS) {
const url = `${BASE_URL}/authorize?provider=${provider}`;
console.log(`Checking [${provider.toUpperCase()}]...`);
try {
const response = await fetch(url, {
method: 'GET',
headers: {
'apikey': ANON_KEY,
'Authorization': `Bearer ${ANON_KEY}`
},
redirect: 'manual'
});
if (response.status === 302) {
console.log('✅ ENABLED: Redirects to GitHub/Google...');
} else if (response.status === 400) {
const data = await response.json();
console.log(`❌ FAILED: ${data.msg} (Code: ${data.error_code})`);
} else {
console.log(`❓ UNKNOWN STATUS (${response.status})`);
}
} catch (error) {
console.error(`💥 FETCH FAILED: ${error.message}`);
}
}
console.log('\n--- DIAGNOSIS SUMMARY ---');
console.log('If GITHUB shows ❌ DISABLED:');
console.log('1. Go to https://app.supabase.com/project/' + PROJECT_ID + '/auth/providers');
console.log('2. Find GitHub and toggle "Enable GitHub" to ON.');
console.log('3. Ensure Client ID and Secret are saved.');
console.log('4. Ensure Callback URL matches: ' + BASE_URL + '/callback');
}
runDiagnostics();