@umituz/react-native-auth 4.3.69 → 4.3.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +1 -11
- package/src/infrastructure/services/AnonymousModeService.ts +9 -3
- package/src/infrastructure/services/AuthEventService.ts +3 -1
- package/src/infrastructure/services/AuthService.ts +3 -1
- package/src/infrastructure/utils/authStateHandler.ts +3 -1
- package/src/infrastructure/utils/calculators/index.ts +0 -6
- package/src/infrastructure/utils/calculators/passwordStrengthCalculator.ts +6 -34
- package/src/infrastructure/utils/calculators/userProfileCalculator.ts +0 -29
- package/src/infrastructure/utils/listener/authListenerStateHandler.ts +3 -1
- package/src/infrastructure/utils/listener/listenerState.util.ts +3 -1
- package/src/infrastructure/utils/listener/setupListener.ts +10 -4
- package/src/infrastructure/utils/safeCallback.ts +12 -4
- package/src/infrastructure/utils/validation/types.ts +7 -11
- package/src/init/createAuthInitModule.ts +9 -3
- package/src/presentation/components/AccountActions.tsx +19 -8
- package/src/presentation/components/AuthErrorDisplay.tsx +6 -5
- package/src/presentation/components/AuthHeader.tsx +11 -3
- package/src/presentation/components/AuthLink.tsx +7 -12
- package/src/presentation/components/PasswordMatchIndicator.tsx +5 -6
- package/src/presentation/components/PasswordStrengthIndicator.tsx +14 -17
- package/src/presentation/components/SocialLoginButtons.tsx +17 -12
- package/src/presentation/hooks/README.md +0 -57
- package/src/presentation/hooks/useAccountManagement.md +0 -1
- package/src/presentation/hooks/useLoginForm.ts +10 -1
- package/src/presentation/hooks/usePasswordPromptNavigation.ts +3 -1
- package/src/presentation/providers/AuthProvider.tsx +3 -1
- package/src/presentation/screens/AccountScreen.tsx +6 -3
- package/src/presentation/screens/LoginScreen.tsx +14 -5
- package/src/presentation/screens/RegisterScreen.tsx +14 -11
- package/src/presentation/stores/authModalStore.ts +6 -2
- package/src/presentation/utils/passwordPromptCallback.ts +3 -1
- package/src/presentation/hooks/useProfileEdit.ts +0 -83
- package/src/presentation/hooks/useSocialLogin.md +0 -381
- package/src/presentation/hooks/useSocialLogin.ts +0 -95
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
# Social Login Hooks
|
|
2
|
-
|
|
3
|
-
Hooks for Google and Apple social authentication.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## useSocialLogin
|
|
8
|
-
|
|
9
|
-
General social login functionality wrapper.
|
|
10
|
-
|
|
11
|
-
### Strategy
|
|
12
|
-
|
|
13
|
-
**Purpose**: Provides unified interface for Google and Apple social authentication by wrapping `@umituz/react-native-firebase`'s `useSocialAuth`.
|
|
14
|
-
|
|
15
|
-
**When to Use**:
|
|
16
|
-
- Need both Google and Apple auth
|
|
17
|
-
- Want unified social auth interface
|
|
18
|
-
- Prefer single hook for multiple providers
|
|
19
|
-
- Don't need provider-specific features
|
|
20
|
-
|
|
21
|
-
**Import Path**:
|
|
22
|
-
```typescript
|
|
23
|
-
import { useSocialLogin } from '@umituz/react-native-auth';
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Hook Location**: `src/presentation/hooks/useSocialLogin.ts`
|
|
27
|
-
|
|
28
|
-
**Dependency**: `@umituz/react-native-firebase`
|
|
29
|
-
|
|
30
|
-
### Rules
|
|
31
|
-
|
|
32
|
-
**MUST**:
|
|
33
|
-
- Configure provider settings before use
|
|
34
|
-
- Check provider availability before showing buttons
|
|
35
|
-
- Handle loading states appropriately
|
|
36
|
-
- Display errors to users
|
|
37
|
-
- Check `googleConfigured` before using Google
|
|
38
|
-
- Check `appleAvailable` before using Apple
|
|
39
|
-
|
|
40
|
-
**MUST NOT**:
|
|
41
|
-
- Show unavailable provider buttons
|
|
42
|
-
- Assume provider is configured
|
|
43
|
-
- Ignore loading states
|
|
44
|
-
- Bypass error handling
|
|
45
|
-
|
|
46
|
-
### Constraints
|
|
47
|
-
|
|
48
|
-
**CONFIGURATION PARAMETERS**:
|
|
49
|
-
- `google?: GoogleAuthConfig` - Google client IDs
|
|
50
|
-
- `apple?: { enabled: boolean }` - Apple enable flag
|
|
51
|
-
|
|
52
|
-
**RETURN VALUES**:
|
|
53
|
-
- `signInWithGoogle: () => Promise<SocialAuthResult>` - Google sign-in
|
|
54
|
-
- `signInWithApple: () => Promise<SocialAuthResult>` - Apple sign-in
|
|
55
|
-
- `googleLoading: boolean` - Google loading state
|
|
56
|
-
- `appleLoading: boolean` - Apple loading state
|
|
57
|
-
- `googleConfigured: boolean` - Google configuration status
|
|
58
|
-
- `appleAvailable: boolean` - Apple availability status
|
|
59
|
-
|
|
60
|
-
**PLATFORM LIMITATIONS**:
|
|
61
|
-
- Google: All platforms
|
|
62
|
-
- Apple: iOS only (returns `appleAvailable: false` on other platforms)
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## useGoogleAuth
|
|
67
|
-
|
|
68
|
-
Google OAuth authentication with expo-auth-session.
|
|
69
|
-
|
|
70
|
-
### Strategy
|
|
71
|
-
|
|
72
|
-
**Purpose**: Complete Google OAuth flow using expo-auth-session for cross-platform support.
|
|
73
|
-
|
|
74
|
-
**When to Use**:
|
|
75
|
-
- Need Google OAuth specifically
|
|
76
|
-
- Want full OAuth flow (not just Firebase)
|
|
77
|
-
- Need web/expo support
|
|
78
|
-
- Require custom Google configuration
|
|
79
|
-
|
|
80
|
-
**Import Path**:
|
|
81
|
-
```typescript
|
|
82
|
-
import { useGoogleAuth } from '@umituz/react-native-auth';
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Hook Location**: `src/presentation/hooks/useSocialLogin.ts`
|
|
86
|
-
|
|
87
|
-
**Dependencies**:
|
|
88
|
-
- `expo-auth-session`
|
|
89
|
-
- `expo-web-browser`
|
|
90
|
-
- `@react-native-firebase/auth`
|
|
91
|
-
|
|
92
|
-
### Rules
|
|
93
|
-
|
|
94
|
-
**MUST**:
|
|
95
|
-
- Provide at least one client ID
|
|
96
|
-
- Call `WebBrowser.maybeCompleteAuthSession()` in app root
|
|
97
|
-
- Check `googleConfigured` before showing button
|
|
98
|
-
- Handle loading and error states
|
|
99
|
-
- Support platform-specific client IDs
|
|
100
|
-
|
|
101
|
-
**MUST NOT**:
|
|
102
|
-
- Call without client ID configuration
|
|
103
|
-
- Skip web browser setup
|
|
104
|
-
- Ignore platform differences
|
|
105
|
-
- Show button if not configured
|
|
106
|
-
|
|
107
|
-
### Constraints
|
|
108
|
-
|
|
109
|
-
**CLIENT IDs REQUIRED**:
|
|
110
|
-
- `iosClientId?: string` - iOS client ID (optional)
|
|
111
|
-
- `webClientId?: string` - Web client ID (optional)
|
|
112
|
-
- `androidClientId?: string` - Android client ID (optional)
|
|
113
|
-
- At least one MUST be provided
|
|
114
|
-
|
|
115
|
-
**RETURN VALUES**:
|
|
116
|
-
- `signInWithGoogle: () => Promise<SocialAuthResult>` - Sign-in function
|
|
117
|
-
- `googleLoading: boolean` - Loading state
|
|
118
|
-
- `googleConfigured: boolean` - Configuration status
|
|
119
|
-
|
|
120
|
-
**PLATFORM BEHAVIOR**:
|
|
121
|
-
- iOS: Uses `iosClientId` or falls back to `webClientId`
|
|
122
|
-
- Android: Uses `androidClientId` or falls back to `webClientId`
|
|
123
|
-
- Web: Uses `webClientId`
|
|
124
|
-
- Requires OAuth 2.0 client ID from Google Cloud Console
|
|
125
|
-
|
|
126
|
-
**SETUP REQUIREMENTS**:
|
|
127
|
-
- OAuth 2.0 Client ID from Google Cloud Console
|
|
128
|
-
- Authorized redirect URI (auto-configured by expo)
|
|
129
|
-
- Web browser warm-up (maybeCompleteAuthSession)
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## useAppleAuth
|
|
134
|
-
|
|
135
|
-
Apple Sign-In authentication wrapper.
|
|
136
|
-
|
|
137
|
-
### Strategy
|
|
138
|
-
|
|
139
|
-
**Purpose**: Convenience wrapper for Apple Sign-In functionality on iOS.
|
|
140
|
-
|
|
141
|
-
**When to Use**:
|
|
142
|
-
- Need Apple Sign-In specifically
|
|
143
|
-
- Targeting iOS users
|
|
144
|
-
- Want simple Apple auth integration
|
|
145
|
-
- Don't need custom Apple configuration
|
|
146
|
-
|
|
147
|
-
**Import Path**:
|
|
148
|
-
```typescript
|
|
149
|
-
import { useAppleAuth } from '@umituz/react-native-auth';
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Hook Location**: `src/presentation/hooks/useSocialLogin.ts`
|
|
153
|
-
|
|
154
|
-
**Dependencies**:
|
|
155
|
-
- `expo-apple-authentication`
|
|
156
|
-
- `@react-native-firebase/auth`
|
|
157
|
-
|
|
158
|
-
### Rules
|
|
159
|
-
|
|
160
|
-
**MUST**:
|
|
161
|
-
- Check `appleAvailable` before showing button
|
|
162
|
-
- Handle loading and error states
|
|
163
|
-
- Only show on iOS platform
|
|
164
|
-
- Support Apple Sign-In requirements
|
|
165
|
-
|
|
166
|
-
**MUST NOT**:
|
|
167
|
-
- Show Apple button on Android/Web
|
|
168
|
-
- Call without availability check
|
|
169
|
-
- Ignore Apple's guidelines
|
|
170
|
-
- Require Apple auth for all users
|
|
171
|
-
|
|
172
|
-
### Constraints
|
|
173
|
-
|
|
174
|
-
**RETURN VALUES**:
|
|
175
|
-
- `signInWithApple: () => Promise<SocialAuthResult>` - Sign-in function
|
|
176
|
-
- `appleLoading: boolean` - Loading state
|
|
177
|
-
- `appleAvailable: boolean` - iOS availability status
|
|
178
|
-
|
|
179
|
-
**PLATFORM SUPPORT**:
|
|
180
|
-
- iOS: ✅ Fully supported (if configured)
|
|
181
|
-
- Android: ❌ Not supported (appleAvailable = false)
|
|
182
|
-
- Web: ❌ Not supported (appleAvailable = false)
|
|
183
|
-
|
|
184
|
-
**SETUP REQUIREMENTS**:
|
|
185
|
-
- Apple Developer account
|
|
186
|
-
- App ID with Sign In with Apple enabled
|
|
187
|
-
- Firebase Auth with Apple enabled
|
|
188
|
-
- Physical device (may not work in simulator)
|
|
189
|
-
|
|
190
|
-
**APPLE GUIDELINES**:
|
|
191
|
-
- Must offer alternative auth methods
|
|
192
|
-
- Cannot require Apple as only option
|
|
193
|
-
- Must follow Apple's UI guidelines
|
|
194
|
-
- Button design per Apple specifications
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## SocialAuthResult
|
|
199
|
-
|
|
200
|
-
Common return type for all social auth functions.
|
|
201
|
-
|
|
202
|
-
### Structure
|
|
203
|
-
|
|
204
|
-
**PROPERTIES**:
|
|
205
|
-
- `success: boolean` - Operation success status
|
|
206
|
-
- `error?: string` - Error message if failed
|
|
207
|
-
- `user?: AuthUser` - User object if successful
|
|
208
|
-
|
|
209
|
-
**Rules**:
|
|
210
|
-
- MUST check `success` before using `user`
|
|
211
|
-
- MUST handle `error` if `success = false`
|
|
212
|
-
- MUST NOT assume `user` exists without checking
|
|
213
|
-
|
|
214
|
-
**Constraints**:
|
|
215
|
-
- Always returns success boolean
|
|
216
|
-
- User object only present on success
|
|
217
|
-
- Error string only present on failure
|
|
218
|
-
- Used by all social auth functions
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## Configuration Strategy
|
|
223
|
-
|
|
224
|
-
### Strategy
|
|
225
|
-
|
|
226
|
-
**Purpose**: Proper setup and configuration for social authentication.
|
|
227
|
-
|
|
228
|
-
**Rules**:
|
|
229
|
-
- MUST configure OAuth providers in Firebase Console
|
|
230
|
-
- MUST set up projects in provider consoles
|
|
231
|
-
- MUST provide correct client IDs
|
|
232
|
-
- MUST test on physical devices
|
|
233
|
-
|
|
234
|
-
**MUST NOT**:
|
|
235
|
-
- Use development client IDs in production
|
|
236
|
-
- Skip provider console setup
|
|
237
|
-
- Assume configuration is correct
|
|
238
|
-
- Test only on simulator
|
|
239
|
-
|
|
240
|
-
### Constraints
|
|
241
|
-
|
|
242
|
-
**FIREBASE SETUP**:
|
|
243
|
-
- Enable Google Sign-In in Firebase Auth
|
|
244
|
-
- Enable Apple Sign-In in Firebase Auth
|
|
245
|
-
- Configure OAuth consent screen
|
|
246
|
-
- Set up authorized domains
|
|
247
|
-
|
|
248
|
-
**GOOGLE CONSOLE SETUP**:
|
|
249
|
-
1. Go to Google Cloud Console
|
|
250
|
-
2. Create OAuth 2.0 Client IDs
|
|
251
|
-
3. Add authorized redirect URIs
|
|
252
|
-
4. Copy client IDs to app config
|
|
253
|
-
|
|
254
|
-
**APPLE SETUP**:
|
|
255
|
-
1. Apple Developer account
|
|
256
|
-
2. Enable Sign In with Apple for App ID
|
|
257
|
-
3. Create provider ID in Firebase
|
|
258
|
-
4. Configure certificates
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Error Handling
|
|
263
|
-
|
|
264
|
-
### Strategy
|
|
265
|
-
|
|
266
|
-
**Purpose**: Graceful handling of social authentication failures.
|
|
267
|
-
|
|
268
|
-
**Rules**:
|
|
269
|
-
- MUST distinguish cancellation from errors
|
|
270
|
-
- MUST show user-friendly error messages
|
|
271
|
-
- MUST allow retry after failures
|
|
272
|
-
- MUST not crash on auth failures
|
|
273
|
-
|
|
274
|
-
**MUST NOT**:
|
|
275
|
-
- Show raw OAuth errors
|
|
276
|
-
- Block retry indefinitely
|
|
277
|
-
- Crash on provider errors
|
|
278
|
-
- Expose sensitive tokens in errors
|
|
279
|
-
|
|
280
|
-
### Constraints
|
|
281
|
-
|
|
282
|
-
**ERROR TYPES**:
|
|
283
|
-
- User cancellation: Silent handling
|
|
284
|
-
- Network errors: Retry prompt
|
|
285
|
-
- Configuration errors: Developer message
|
|
286
|
-
- Provider errors: Generic "try again"
|
|
287
|
-
|
|
288
|
-
**CANCELLATION HANDLING**:
|
|
289
|
-
- Check error message for "cancelled"
|
|
290
|
-
- Don't show error for cancellation
|
|
291
|
-
- Allow retry without blocking
|
|
292
|
-
- Silent return preferred
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
## Security Requirements
|
|
297
|
-
|
|
298
|
-
### Strategy
|
|
299
|
-
|
|
300
|
-
**Purpose**: Secure social authentication implementation.
|
|
301
|
-
|
|
302
|
-
**Rules**:
|
|
303
|
-
- MUST use HTTPS for all OAuth endpoints
|
|
304
|
-
- MUST store tokens securely
|
|
305
|
-
- MUST validate tokens server-side
|
|
306
|
-
- MUST never log OAuth credentials
|
|
307
|
-
- MUST implement token refresh
|
|
308
|
-
|
|
309
|
-
**MUST NOT**:
|
|
310
|
-
- Store tokens in AsyncStorage
|
|
311
|
-
- Log OAuth responses
|
|
312
|
-
- Skip server-side validation
|
|
313
|
-
- Expose client secrets
|
|
314
|
-
- Use HTTP for OAuth flows
|
|
315
|
-
|
|
316
|
-
### Constraints
|
|
317
|
-
|
|
318
|
-
**TOKEN HANDLING**:
|
|
319
|
-
- Tokens managed by Firebase SDK
|
|
320
|
-
- Secure storage automatic
|
|
321
|
-
- App never accesses refresh tokens
|
|
322
|
-
- ID tokens available for API calls
|
|
323
|
-
- Token refresh handled by Firebase
|
|
324
|
-
|
|
325
|
-
**CLIENT SECRETS**:
|
|
326
|
-
- Never included in app code
|
|
327
|
-
- Public client flows only
|
|
328
|
-
- Server-side validation required
|
|
329
|
-
- Firebase manages credentials
|
|
330
|
-
|
|
331
|
-
---
|
|
332
|
-
|
|
333
|
-
## Platform-Specific Behavior
|
|
334
|
-
|
|
335
|
-
### Strategy
|
|
336
|
-
|
|
337
|
-
**Purpose**: Optimize social auth experience for each platform.
|
|
338
|
-
|
|
339
|
-
**Rules**:
|
|
340
|
-
- MUST respect platform limitations
|
|
341
|
-
- MUST use appropriate client IDs
|
|
342
|
-
- MUST handle platform-specific errors
|
|
343
|
-
- MUST test on target platforms
|
|
344
|
-
|
|
345
|
-
**Constraints**:
|
|
346
|
-
|
|
347
|
-
**iOS**:
|
|
348
|
-
- Apple Sign-In available
|
|
349
|
-
- Google uses app-based OAuth
|
|
350
|
-
- Requires Info.plist configuration
|
|
351
|
-
- Best on physical devices
|
|
352
|
-
|
|
353
|
-
**Android**:
|
|
354
|
-
- Apple Sign-In NOT available
|
|
355
|
-
- Google uses app-based OAuth
|
|
356
|
-
- Requires google-services.json
|
|
357
|
-
- Works on emulator
|
|
358
|
-
|
|
359
|
-
**Web**:
|
|
360
|
-
- Apple Sign-In NOT available
|
|
361
|
-
- Google uses popup OAuth
|
|
362
|
-
- Requires proper callback handling
|
|
363
|
-
- Browser popup blockers
|
|
364
|
-
|
|
365
|
-
---
|
|
366
|
-
|
|
367
|
-
## Related Hooks
|
|
368
|
-
|
|
369
|
-
- **`useAuth`** (`src/presentation/hooks/useAuth.ts`) - Core authentication state
|
|
370
|
-
- **`useAuthBottomSheet`** (`src/presentation/hooks/useAuthBottomSheet.md`) - Auth modal integration
|
|
371
|
-
|
|
372
|
-
## Related Components
|
|
373
|
-
|
|
374
|
-
- **`SocialLoginButtons`** (`src/presentation/components/SocialLoginButtons.md`) - Social auth UI
|
|
375
|
-
|
|
376
|
-
## External Dependencies
|
|
377
|
-
|
|
378
|
-
- **`@umituz/react-native-firebase`** - Firebase social auth wrapper
|
|
379
|
-
- **`expo-auth-session`** - OAuth session management
|
|
380
|
-
- **`expo-web-browser`** - Web browser for OAuth
|
|
381
|
-
- **`expo-apple-authentication`** - Apple Sign-In
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useSocialLogin Hook
|
|
3
|
-
* Provides unified social login functionality using Firebase package
|
|
4
|
-
*
|
|
5
|
-
* This hook wraps @umituz/react-native-firebase's useSocialAuth
|
|
6
|
-
* and provides a simple interface for social authentication.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const { signInWithGoogle, signInWithApple, googleLoading, appleLoading } = useSocialLogin({
|
|
11
|
-
* google: { webClientId: '...', iosClientId: '...' },
|
|
12
|
-
* apple: { enabled: true }
|
|
13
|
-
* });
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { useCallback } from "react";
|
|
18
|
-
import { Platform } from "react-native";
|
|
19
|
-
import {
|
|
20
|
-
useSocialAuth,
|
|
21
|
-
type SocialAuthConfig,
|
|
22
|
-
type SocialAuthResult,
|
|
23
|
-
} from "@umituz/react-native-firebase";
|
|
24
|
-
|
|
25
|
-
export interface UseSocialLoginConfig extends SocialAuthConfig {}
|
|
26
|
-
|
|
27
|
-
export interface UseSocialLoginResult {
|
|
28
|
-
/** Sign in with Google (handles OAuth flow internally if configured) */
|
|
29
|
-
signInWithGoogle: () => Promise<SocialAuthResult>;
|
|
30
|
-
/** Sign in with Apple */
|
|
31
|
-
signInWithApple: () => Promise<SocialAuthResult>;
|
|
32
|
-
/** Whether Google sign-in is in progress */
|
|
33
|
-
googleLoading: boolean;
|
|
34
|
-
/** Whether Apple sign-in is in progress */
|
|
35
|
-
appleLoading: boolean;
|
|
36
|
-
/** Whether Google is configured */
|
|
37
|
-
googleConfigured: boolean;
|
|
38
|
-
/** Whether Apple is available */
|
|
39
|
-
appleAvailable: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Hook for social authentication
|
|
44
|
-
* Integrates with @umituz/react-native-firebase for Firebase auth
|
|
45
|
-
*/
|
|
46
|
-
export function useSocialLogin(config?: UseSocialLoginConfig): UseSocialLoginResult {
|
|
47
|
-
const {
|
|
48
|
-
signInWithApple: firebaseSignInWithApple,
|
|
49
|
-
googleLoading,
|
|
50
|
-
appleLoading,
|
|
51
|
-
googleConfigured,
|
|
52
|
-
appleAvailable,
|
|
53
|
-
} = useSocialAuth(config);
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Sign in with Google
|
|
57
|
-
* Note: For full OAuth flow, use useGoogleAuth hook which handles
|
|
58
|
-
* expo-auth-session OAuth flow and Firebase authentication
|
|
59
|
-
*/
|
|
60
|
-
const signInWithGoogle = useCallback((): Promise<SocialAuthResult> => {
|
|
61
|
-
if (!googleConfigured) {
|
|
62
|
-
return Promise.resolve({ success: false, error: "Google Sign-In is not configured" });
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return Promise.resolve({
|
|
66
|
-
success: false,
|
|
67
|
-
error: "Use useGoogleAuth hook for Google OAuth flow",
|
|
68
|
-
});
|
|
69
|
-
}, [googleConfigured]);
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Sign in with Apple (full flow handled by Firebase package)
|
|
73
|
-
*/
|
|
74
|
-
const signInWithApple = useCallback(async (): Promise<SocialAuthResult> => {
|
|
75
|
-
if (Platform.OS !== "ios") {
|
|
76
|
-
return { success: false, error: "Apple Sign-In is only available on iOS" };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!appleAvailable) {
|
|
80
|
-
return { success: false, error: "Apple Sign-In is not available" };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return firebaseSignInWithApple();
|
|
84
|
-
}, [appleAvailable, firebaseSignInWithApple]);
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
signInWithGoogle,
|
|
88
|
-
signInWithApple,
|
|
89
|
-
googleLoading,
|
|
90
|
-
appleLoading,
|
|
91
|
-
googleConfigured,
|
|
92
|
-
appleAvailable,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|