-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart-oauth-server.ps1
More file actions
122 lines (110 loc) Β· 5.48 KB
/
start-oauth-server.ps1
File metadata and controls
122 lines (110 loc) Β· 5.48 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Script para iniciar servidor HTTP local para Google OAuth
# Ejecuta: .\start-oauth-server.ps1
Write-Host "π§ Iniciando servidor HTTP para Google OAuth..." -ForegroundColor Green
Write-Host ""
# Verificar si Python estΓ‘ disponible
$pythonAvailable = $false
try {
$pythonVersion = python --version 2>$null
if ($pythonVersion) {
$pythonAvailable = $true
Write-Host "β
Python encontrado: $pythonVersion" -ForegroundColor Green
}
} catch {
Write-Host "β Python no encontrado" -ForegroundColor Yellow
}
# Verificar si Node.js estΓ‘ disponible
$nodeAvailable = $false
try {
$nodeVersion = node --version 2>$null
if ($nodeVersion) {
$nodeAvailable = $true
Write-Host "β
Node.js encontrado: $nodeVersion" -ForegroundColor Green
}
} catch {
Write-Host "β Node.js no encontrado" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "π Directorio actual: $PWD" -ForegroundColor Cyan
Write-Host ""
# Mostrar opciones disponibles
Write-Host "Opciones disponibles:" -ForegroundColor White
Write-Host "1. Python HTTP Server (Puerto 8000) - Recomendado" -ForegroundColor White
Write-Host "2. Node.js http-server (Puerto 8080)" -ForegroundColor White
Write-Host "3. Instrucciones para VS Code Live Server" -ForegroundColor White
Write-Host "4. Salir" -ForegroundColor White
Write-Host ""
$choice = Read-Host "Selecciona una opciΓ³n (1-4)"
switch ($choice) {
"1" {
if ($pythonAvailable) {
Write-Host "π Iniciando Python HTTP Server en puerto 8000..." -ForegroundColor Green
Write-Host ""
Write-Host "π± URLs de prueba:" -ForegroundColor Yellow
Write-Host " DiagnΓ³stico OAuth: http://localhost:8000/google_oauth_diagnostico.html" -ForegroundColor Cyan
Write-Host " Frontend ejemplo: http://localhost:8000/frontend-google-auth/index.html" -ForegroundColor Cyan
Write-Host ""
Write-Host "π‘ Presiona Ctrl+C para detener el servidor" -ForegroundColor Yellow
Write-Host "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ" -ForegroundColor Gray
Write-Host ""
python -m http.server 8000
} else {
Write-Host "β Python no estΓ‘ disponible. Instala Python desde https://python.org" -ForegroundColor Red
}
}
"2" {
if ($nodeAvailable) {
Write-Host "π’ Verificando http-server..." -ForegroundColor Green
# Verificar si http-server estΓ‘ instalado
try {
npx http-server --version 2>$null | Out-Null
Write-Host "β
http-server disponible" -ForegroundColor Green
} catch {
Write-Host "π¦ Instalando http-server..." -ForegroundColor Yellow
npm install -g http-server
}
Write-Host "π’ Iniciando Node.js HTTP Server en puerto 8080..." -ForegroundColor Green
Write-Host ""
Write-Host "π± URLs de prueba:" -ForegroundColor Yellow
Write-Host " DiagnΓ³stico OAuth: http://localhost:8080/google_oauth_diagnostico.html" -ForegroundColor Cyan
Write-Host " Frontend ejemplo: http://localhost:8080/frontend-google-auth/index.html" -ForegroundColor Cyan
Write-Host ""
Write-Host "π‘ Presiona Ctrl+C para detener el servidor" -ForegroundColor Yellow
Write-Host "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ" -ForegroundColor Gray
Write-Host ""
npx http-server -p 8080
} else {
Write-Host "β Node.js no estΓ‘ disponible. Instala Node.js desde https://nodejs.org" -ForegroundColor Red
}
}
"3" {
Write-Host ""
Write-Host "π Instrucciones para VS Code Live Server:" -ForegroundColor Yellow
Write-Host ""
Write-Host "1. Abre VS Code" -ForegroundColor White
Write-Host "2. Instala la extensiΓ³n 'Live Server' de Ritwick Dey" -ForegroundColor White
Write-Host "3. Haz clic derecho en 'google_oauth_diagnostico.html'" -ForegroundColor White
Write-Host "4. Selecciona 'Open with Live Server'" -ForegroundColor White
Write-Host "5. Se abrirΓ‘ automΓ‘ticamente en el navegador" -ForegroundColor White
Write-Host ""
Write-Host "π± URL tΓpica: http://127.0.0.1:5500/google_oauth_diagnostico.html" -ForegroundColor Cyan
Write-Host ""
Read-Host "Presiona Enter para continuar"
}
"4" {
Write-Host "π Β‘Hasta luego!" -ForegroundColor Green
exit
}
default {
Write-Host "β OpciΓ³n no vΓ‘lida" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "π§ ConfiguraciΓ³n de Google Cloud Console:" -ForegroundColor Yellow
Write-Host " AsegΓΊrate de agregar estos orΓgenes en Google Cloud Console:" -ForegroundColor White
Write-Host " - http://localhost:8000" -ForegroundColor Cyan
Write-Host " - http://localhost:8080" -ForegroundColor Cyan
Write-Host " - http://127.0.0.1:5500" -ForegroundColor Cyan
Write-Host ""
Write-Host "π Google Cloud Console: https://console.cloud.google.com/apis/credentials" -ForegroundColor Cyan
Write-Host "π Tu Client ID: 102613720703-cq73g92su0v8kevc0iuftjak0tm1e1al.apps.googleusercontent.com" -ForegroundColor Cyan