@@ -78,20 +78,6 @@ export class AuthService {
78
78
redirectUrl ,
79
79
) ;
80
80
81
- // Debug: Store what we actually got back from Appwrite for Google
82
- if ( typeof window !== "undefined" ) {
83
- try {
84
- sessionStorage . setItem ( "google_oauth_response_type" , typeof url ) ;
85
- sessionStorage . setItem (
86
- "google_oauth_response_value" ,
87
- JSON . stringify ( url ) ,
88
- ) ;
89
- ( window as any ) . googleOAuthResponse = url ;
90
- } catch ( e ) {
91
- // Ignore storage errors
92
- }
93
- }
94
-
95
81
if ( typeof url === "string" ) {
96
82
window . location . href = url ;
97
83
}
@@ -134,117 +120,17 @@ export class AuthService {
134
120
135
121
const redirectUrl = `${ window . location . origin } /auth/callback` ;
136
122
137
- // Add debug info to sessionStorage for production debugging
138
- if ( typeof window !== "undefined" ) {
139
- const debugInfo = {
140
- timestamp : new Date ( ) . toISOString ( ) ,
141
- action : "apple_oauth_start" ,
142
- redirectUrl,
143
- origin : window . location . origin ,
144
- hostname : window . location . hostname ,
145
- } ;
146
-
147
- try {
148
- sessionStorage . setItem (
149
- "apple_oauth_debug" ,
150
- JSON . stringify ( debugInfo ) ,
151
- ) ;
152
- // Also add to window object for console inspection
153
- ( window as any ) . appleOAuthDebug = debugInfo ;
154
- } catch ( e ) {
155
- // Ignore storage errors
156
- }
157
- }
158
-
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
-
171
123
const url = await account ! . createOAuth2Session (
172
124
"apple" as any ,
173
125
redirectUrl ,
174
126
redirectUrl ,
175
127
) ;
176
128
177
- // Debug: Store what we actually got back from Appwrite
178
- if ( typeof window !== "undefined" ) {
179
- try {
180
- sessionStorage . setItem (
181
- "apple_oauth_after_call" ,
182
- new Date ( ) . toISOString ( ) ,
183
- ) ;
184
- sessionStorage . setItem ( "apple_oauth_response_type" , typeof url ) ;
185
- sessionStorage . setItem (
186
- "apple_oauth_response_value" ,
187
- JSON . stringify ( url ) ,
188
- ) ;
189
- ( window as any ) . appleOAuthResponse = url ;
190
- } catch ( e ) {
191
- // Ignore storage errors
192
- }
193
- }
194
-
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
-
211
129
if ( typeof url === "string" ) {
212
- // Store success info
213
- if ( typeof window !== "undefined" ) {
214
- try {
215
- sessionStorage . setItem ( "apple_oauth_redirect_url" , url ) ;
216
- } catch ( e ) {
217
- // Ignore storage errors
218
- }
219
- }
220
130
window . location . href = url ;
221
131
}
222
132
return { success : true } ;
223
133
} catch ( error : any ) {
224
- // Store error info for debugging in production
225
- if ( typeof window !== "undefined" ) {
226
- const errorInfo = {
227
- timestamp : new Date ( ) . toISOString ( ) ,
228
- action : "apple_oauth_error" ,
229
- message : error . message ,
230
- code : error . code ,
231
- type : error . type ,
232
- name : error . name ,
233
- stack : error . stack ,
234
- } ;
235
-
236
- try {
237
- sessionStorage . setItem (
238
- "apple_oauth_error" ,
239
- JSON . stringify ( errorInfo ) ,
240
- ) ;
241
- // Also add to window object
242
- ( window as any ) . appleOAuthError = errorInfo ;
243
- } catch ( e ) {
244
- // Ignore storage errors
245
- }
246
- }
247
-
248
134
return {
249
135
success : false ,
250
136
error : {
0 commit comments