-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-auth.js
More file actions
74 lines (61 loc) · 2.31 KB
/
test-auth.js
File metadata and controls
74 lines (61 loc) · 2.31 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env node
// Simple test script to verify Google OAuth environment variables
console.log('🔍 Testing DreamForge Authentication Setup...\n')
// Check environment variables
const requiredEnvVars = [
'NEXTAUTH_URL',
'NEXTAUTH_SECRET',
'DATABASE_URL',
'OPENAI_API_KEY'
]
const optionalEnvVars = [
'GOOGLE_CLIENT_ID',
'GOOGLE_CLIENT_SECRET',
'GITHUB_ID',
'GITHUB_SECRET'
]
console.log('📋 Required Environment Variables:')
let missingRequired = []
requiredEnvVars.forEach(varName => {
const value = process.env[varName]
const status = value ? '✅' : '❌'
const displayValue = value ? (varName.includes('SECRET') || varName.includes('KEY') ? '[HIDDEN]' : value) : 'NOT SET'
console.log(`${status} ${varName}: ${displayValue}`)
if (!value) {
missingRequired.push(varName)
}
})
console.log('\n🔧 Optional OAuth Variables:')
optionalEnvVars.forEach(varName => {
const value = process.env[varName]
const status = value ? '✅' : '⚠️'
const displayValue = value ? (varName.includes('SECRET') ? '[HIDDEN]' : '[SET]') : 'NOT SET'
console.log(`${status} ${varName}: ${displayValue}`)
})
// Provide setup guidance
console.log('\n' + '='.repeat(50))
if (missingRequired.length > 0) {
console.log('❌ Missing Required Variables:')
missingRequired.forEach(varName => {
console.log(` - ${varName}`)
})
console.log('\n💡 Please set these in your .env.local file')
} else {
console.log('✅ All required environment variables are set!')
}
const hasGoogleOAuth = process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET
const hasGitHubOAuth = process.env.GITHUB_ID && process.env.GITHUB_SECRET
if (!hasGoogleOAuth && !hasGitHubOAuth) {
console.log('\n📝 To enable social login:')
console.log(' • For Google OAuth: See GOOGLE_OAUTH_SETUP.md')
console.log(' • For GitHub OAuth: Set GITHUB_ID and GITHUB_SECRET')
} else {
console.log('\n🎉 OAuth providers configured:')
if (hasGoogleOAuth) console.log(' ✅ Google OAuth')
if (hasGitHubOAuth) console.log(' ✅ GitHub OAuth')
}
console.log('\n🚀 Next steps:')
console.log(' 1. Set up your database: npx prisma generate && npx prisma db push')
console.log(' 2. Start development server: npm run dev')
console.log(' 3. Visit http://localhost:3000/auth/signin to test')
console.log('\n' + '='.repeat(50))