fix(auth): ATTEMPTED fix for google oauth (lowk havent tested this)
This commit is contained in:
parent
135caf101f
commit
e15ca352a0
1 changed files with 9 additions and 5 deletions
|
|
@ -12,14 +12,19 @@ export class AuthManager {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const userId = params.get('userId');
|
const userId = params.get('userId');
|
||||||
const secret = params.get('secret');
|
const secret = params.get('secret');
|
||||||
|
const isOAuthRedirect = params.get('oauth') === '1';
|
||||||
|
|
||||||
if (userId && secret) {
|
if (userId && secret && userId !== 'null' && secret !== 'null') {
|
||||||
try {
|
try {
|
||||||
await auth.createSession(userId, secret);
|
await auth.createSession(userId, secret);
|
||||||
window.history.replaceState({}, '', window.location.pathname);
|
window.history.replaceState({}, '', window.location.pathname);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('OAuth session creation failed:', error);
|
console.warn('OAuth session handoff failed:', error.message);
|
||||||
|
window.history.replaceState({}, '', window.location.pathname);
|
||||||
}
|
}
|
||||||
|
} else if (isOAuthRedirect) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||||||
|
window.history.replaceState({}, '', window.location.pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -44,7 +49,7 @@ export class AuthManager {
|
||||||
try {
|
try {
|
||||||
auth.createOAuth2Session(
|
auth.createOAuth2Session(
|
||||||
'google',
|
'google',
|
||||||
window.location.origin + '/index.html',
|
window.location.origin + '/index.html?oauth=1',
|
||||||
window.location.origin + '/login.html'
|
window.location.origin + '/login.html'
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -118,9 +123,8 @@ export class AuthManager {
|
||||||
const emailContainer = document.getElementById('email-auth-container');
|
const emailContainer = document.getElementById('email-auth-container');
|
||||||
const emailToggleBtn = document.getElementById('toggle-email-auth-btn');
|
const emailToggleBtn = document.getElementById('toggle-email-auth-btn');
|
||||||
|
|
||||||
if (!connectBtn) return; // UI might not be rendered yet
|
if (!connectBtn) return;
|
||||||
|
|
||||||
// Auth gate active: strip down to status + sign out only
|
|
||||||
if (window.__AUTH_GATE__) {
|
if (window.__AUTH_GATE__) {
|
||||||
connectBtn.textContent = 'Sign Out';
|
connectBtn.textContent = 'Sign Out';
|
||||||
connectBtn.classList.add('danger');
|
connectBtn.classList.add('danger');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue