genesis
This commit is contained in:
57
debug-login.html
Normal file
57
debug-login.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>FibDash Login Debug</title>
|
||||
<script src="https://accounts.google.com/gsi/client" async defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>FibDash Login Debug</h1>
|
||||
|
||||
<div id="status">Initializing...</div>
|
||||
|
||||
<div id="g_id_onload"
|
||||
data-client_id="928121624463-jbgfdlgem22scs1k9c87ucg4ffvaik6o.apps.googleusercontent.com"
|
||||
data-callback="handleCredentialResponse">
|
||||
</div>
|
||||
|
||||
<div class="g_id_signin" data-type="standard"></div>
|
||||
|
||||
<script>
|
||||
function handleCredentialResponse(response) {
|
||||
console.log('Google credential response:', response);
|
||||
document.getElementById('status').innerHTML = 'Got Google token, sending to server...';
|
||||
|
||||
// Send to our backend
|
||||
fetch('/api/auth/google', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: response.credential
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
console.log('Server response status:', response.status);
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Server response data:', data);
|
||||
if (data.success) {
|
||||
document.getElementById('status').innerHTML = '✅ Login successful! User: ' + data.user.email;
|
||||
} else {
|
||||
document.getElementById('status').innerHTML = '❌ Login failed: ' + (data.message || data.error);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Login error:', error);
|
||||
document.getElementById('status').innerHTML = '❌ Network error: ' + error.message;
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
document.getElementById('status').innerHTML = 'Ready - Click "Sign in with Google"';
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user