@fastshot/auth 1.0.3 → 1.0.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastshot/auth",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "OAuth authentication SDK for Expo React Native applications with Supabase",
5
5
  "main": "src/index.ts",
6
6
  "repository": {
package/src/auth.ts CHANGED
@@ -123,6 +123,12 @@ async function signInWithProvider(
123
123
  if (!callbackResult.success) {
124
124
  throw createAuthError('UNKNOWN_ERROR', callbackResult.error || 'Failed to complete authentication');
125
125
  }
126
+ } else {
127
+ // Handle unexpected browser result (e.g., success without URL)
128
+ throw createAuthError(
129
+ 'UNKNOWN_ERROR',
130
+ `Unexpected auth result: type=${result.type}, hasUrl=${!!(result as any).url}`
131
+ );
126
132
  }
127
133
  }
128
134
 
@@ -74,6 +74,8 @@ export function useAppleSignIn(config: UseAppleSignInConfig): UseAppleSignInResu
74
74
 
75
75
  setError(authError);
76
76
  config.onError?.(authError);
77
+ // Re-throw so caller can also handle the error
78
+ throw authError;
77
79
  } finally {
78
80
  setIsLoading(false);
79
81
  }
@@ -77,6 +77,8 @@ export function useGoogleSignIn(config: UseGoogleSignInConfig): UseGoogleSignInR
77
77
 
78
78
  setError(authError);
79
79
  config.onError?.(authError);
80
+ // Re-throw so caller can also handle the error
81
+ throw authError;
80
82
  } finally {
81
83
  setIsLoading(false);
82
84
  }
@@ -36,7 +36,14 @@ export function parseCallbackUrl(url: string): {
36
36
  return {};
37
37
  }
38
38
 
39
- const queryString = url.substring(queryStart + 1);
39
+ // Get query string and strip any URL fragment (#)
40
+ // iOS often appends a trailing # to callback URLs
41
+ let queryString = url.substring(queryStart + 1);
42
+ const hashIndex = queryString.indexOf('#');
43
+ if (hashIndex !== -1) {
44
+ queryString = queryString.substring(0, hashIndex);
45
+ }
46
+
40
47
  const params = new URLSearchParams(queryString);
41
48
 
42
49
  return {