Add OAuth debugging console.log statements
All checks were successful
Deploy / deploy (push) Successful in 1m38s

Temporary debugging to diagnose why authWithOAuth2 promise
doesn't resolve after successful code exchange.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-12 13:49:02 +00:00
parent 5cac8f3267
commit e2afee2045
2 changed files with 16 additions and 1 deletions

View File

@@ -22,6 +22,10 @@ vi.mock("@/lib/pocketbase", () => ({
authWithOAuth2: mockAuthWithOAuth2,
listAuthMethods: mockListAuthMethods,
}),
authStore: {
isValid: true,
token: "mock-test-token-for-debugging",
},
},
}));

View File

@@ -120,11 +120,22 @@ export default function LoginPage() {
setError(null);
try {
await pb.collection("users").authWithOAuth2({ provider: "oidc" });
console.log("[OAuth] Starting authWithOAuth2...");
const result = await pb
.collection("users")
.authWithOAuth2({ provider: "oidc" });
console.log("[OAuth] authWithOAuth2 resolved:", result);
console.log("[OAuth] authStore.isValid:", pb.authStore?.isValid);
console.log(
"[OAuth] authStore.token:",
`${pb.authStore?.token?.substring(0, 20)}...`,
);
// Reset attempts on successful login
setLoginAttempts([]);
console.log("[OAuth] Calling router.push...");
router.push("/");
} catch (err) {
console.error("[OAuth] Error caught:", err);
// Record the failed attempt
recordAttempt();
const message =