Add OAuth debugging console.log statements
All checks were successful
Deploy / deploy (push) Successful in 1m38s
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:
@@ -22,6 +22,10 @@ vi.mock("@/lib/pocketbase", () => ({
|
|||||||
authWithOAuth2: mockAuthWithOAuth2,
|
authWithOAuth2: mockAuthWithOAuth2,
|
||||||
listAuthMethods: mockListAuthMethods,
|
listAuthMethods: mockListAuthMethods,
|
||||||
}),
|
}),
|
||||||
|
authStore: {
|
||||||
|
isValid: true,
|
||||||
|
token: "mock-test-token-for-debugging",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -120,11 +120,22 @@ export default function LoginPage() {
|
|||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
try {
|
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
|
// Reset attempts on successful login
|
||||||
setLoginAttempts([]);
|
setLoginAttempts([]);
|
||||||
|
console.log("[OAuth] Calling router.push...");
|
||||||
router.push("/");
|
router.push("/");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error("[OAuth] Error caught:", err);
|
||||||
// Record the failed attempt
|
// Record the failed attempt
|
||||||
recordAttempt();
|
recordAttempt();
|
||||||
const message =
|
const message =
|
||||||
|
|||||||
Reference in New Issue
Block a user