Skip to content

Commit 709a033

Browse files
chore: further debug Apple SSO
1 parent a2c15cf commit 709a033

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lib/appwrite/auth.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@ export class AuthService {
156156
}
157157
}
158158

159+
// Debug: Store that we're about to call createOAuth2Session
160+
if (typeof window !== "undefined") {
161+
try {
162+
sessionStorage.setItem(
163+
"apple_oauth_before_call",
164+
new Date().toISOString(),
165+
);
166+
} catch (e) {
167+
// Ignore storage errors
168+
}
169+
}
170+
159171
const url = await account!.createOAuth2Session(
160172
"apple" as any,
161173
redirectUrl,
@@ -165,6 +177,10 @@ export class AuthService {
165177
// Debug: Store what we actually got back from Appwrite
166178
if (typeof window !== "undefined") {
167179
try {
180+
sessionStorage.setItem(
181+
"apple_oauth_after_call",
182+
new Date().toISOString(),
183+
);
168184
sessionStorage.setItem("apple_oauth_response_type", typeof url);
169185
sessionStorage.setItem(
170186
"apple_oauth_response_value",
@@ -176,6 +192,22 @@ export class AuthService {
176192
}
177193
}
178194

195+
// If we get here without an error and url is undefined,
196+
// it might mean Appwrite handles the redirect internally
197+
if (url === undefined) {
198+
// Store that we got undefined but no error
199+
if (typeof window !== "undefined") {
200+
try {
201+
sessionStorage.setItem(
202+
"apple_oauth_undefined_no_error",
203+
new Date().toISOString(),
204+
);
205+
} catch (e) {
206+
// Ignore storage errors
207+
}
208+
}
209+
}
210+
179211
if (typeof url === "string") {
180212
// Store success info
181213
if (typeof window !== "undefined") {

0 commit comments

Comments
 (0)