@clerk/expo 3.0.0-snapshot.v20251218165926 → 3.0.0-snapshot.v20251224145055

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.
Files changed (51) hide show
  1. package/dist/errorThrower.d.ts +1 -1
  2. package/dist/hooks/index.d.ts +0 -1
  3. package/dist/hooks/index.d.ts.map +1 -1
  4. package/dist/hooks/index.js +0 -2
  5. package/dist/hooks/index.js.map +1 -1
  6. package/dist/provider/ClerkProvider.js +1 -1
  7. package/dist/utils/errors.d.ts +1 -1
  8. package/package.json +9 -21
  9. package/android/build.gradle +0 -64
  10. package/android/src/main/AndroidManifest.xml +0 -2
  11. package/android/src/main/java/expo/modules/clerk/googlesignin/ClerkGoogleSignInModule.kt +0 -264
  12. package/app.plugin.js +0 -1
  13. package/dist/google-one-tap/ClerkGoogleOneTapSignIn.d.ts +0 -85
  14. package/dist/google-one-tap/ClerkGoogleOneTapSignIn.d.ts.map +0 -1
  15. package/dist/google-one-tap/ClerkGoogleOneTapSignIn.js +0 -153
  16. package/dist/google-one-tap/ClerkGoogleOneTapSignIn.js.map +0 -1
  17. package/dist/google-one-tap/index.d.ts +0 -3
  18. package/dist/google-one-tap/index.d.ts.map +0 -1
  19. package/dist/google-one-tap/index.js +0 -37
  20. package/dist/google-one-tap/index.js.map +0 -1
  21. package/dist/google-one-tap/types.d.ts +0 -145
  22. package/dist/google-one-tap/types.d.ts.map +0 -1
  23. package/dist/google-one-tap/types.js +0 -17
  24. package/dist/google-one-tap/types.js.map +0 -1
  25. package/dist/hooks/useSignInWithGoogle.android.d.ts +0 -46
  26. package/dist/hooks/useSignInWithGoogle.android.d.ts.map +0 -1
  27. package/dist/hooks/useSignInWithGoogle.android.js +0 -30
  28. package/dist/hooks/useSignInWithGoogle.android.js.map +0 -1
  29. package/dist/hooks/useSignInWithGoogle.d.ts +0 -52
  30. package/dist/hooks/useSignInWithGoogle.d.ts.map +0 -1
  31. package/dist/hooks/useSignInWithGoogle.ios.d.ts +0 -46
  32. package/dist/hooks/useSignInWithGoogle.ios.d.ts.map +0 -1
  33. package/dist/hooks/useSignInWithGoogle.ios.js +0 -30
  34. package/dist/hooks/useSignInWithGoogle.ios.js.map +0 -1
  35. package/dist/hooks/useSignInWithGoogle.js +0 -39
  36. package/dist/hooks/useSignInWithGoogle.js.map +0 -1
  37. package/dist/hooks/useSignInWithGoogle.shared.d.ts +0 -29
  38. package/dist/hooks/useSignInWithGoogle.shared.d.ts.map +0 -1
  39. package/dist/hooks/useSignInWithGoogle.shared.js +0 -164
  40. package/dist/hooks/useSignInWithGoogle.shared.js.map +0 -1
  41. package/dist/hooks/useSignInWithGoogle.types.d.ts +0 -11
  42. package/dist/hooks/useSignInWithGoogle.types.d.ts.map +0 -1
  43. package/dist/hooks/useSignInWithGoogle.types.js +0 -17
  44. package/dist/hooks/useSignInWithGoogle.types.js.map +0 -1
  45. package/dist/plugin/withClerkExpo.d.ts +0 -4
  46. package/dist/plugin/withClerkExpo.d.ts.map +0 -1
  47. package/dist/plugin/withClerkExpo.js +0 -61
  48. package/dist/plugin/withClerkExpo.js.map +0 -1
  49. package/expo-module.config.json +0 -9
  50. package/ios/ClerkGoogleSignIn.podspec +0 -22
  51. package/ios/ClerkGoogleSignInModule.swift +0 -229
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var useSignInWithGoogle_exports = {};
20
- __export(useSignInWithGoogle_exports, {
21
- useSignInWithGoogle: () => useSignInWithGoogle
22
- });
23
- module.exports = __toCommonJS(useSignInWithGoogle_exports);
24
- var import_errors = require("../utils/errors");
25
- function useSignInWithGoogle() {
26
- function startGoogleAuthenticationFlow(_startGoogleAuthenticationFlowParams) {
27
- return import_errors.errorThrower.throw(
28
- 'Native Google Authentication is only available on iOS and Android. For web and other platforms, please use the OAuth-based flow with useSSO and strategy: "oauth_google".'
29
- );
30
- }
31
- return {
32
- startGoogleAuthenticationFlow
33
- };
34
- }
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- useSignInWithGoogle
38
- });
39
- //# sourceMappingURL=useSignInWithGoogle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useSignInWithGoogle.ts"],"sourcesContent":["import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';\n\nimport { errorThrower } from '../utils/errors';\n\ntype SignUpUnsafeMetadata = Record<string, unknown>;\n\nexport type StartGoogleAuthenticationFlowParams = {\n unsafeMetadata?: SignUpUnsafeMetadata;\n};\n\nexport type StartGoogleAuthenticationFlowReturnType = {\n createdSessionId: string | null;\n setActive?: SetActive;\n signIn?: SignInResource;\n signUp?: SignUpResource;\n};\n\n/**\n * Stub for Google Authentication hook on unsupported platforms.\n *\n * Native Google Authentication is only available on iOS and Android.\n * For web platforms, use the OAuth-based Google Sign-In flow instead via useSSO.\n *\n * @example\n * ```tsx\n * import { useSSO } from '@clerk/clerk-expo';\n * import { Button } from 'react-native';\n *\n * function GoogleSignInButton() {\n * const { startSSOFlow } = useSSO();\n *\n * const onPress = async () => {\n * try {\n * const { createdSessionId, setActive } = await startSSOFlow({\n * strategy: 'oauth_google'\n * });\n *\n * if (createdSessionId && setActive) {\n * await setActive({ session: createdSessionId });\n * }\n * } catch (err) {\n * console.error('Google Authentication error:', err);\n * }\n * };\n *\n * return <Button title=\"Sign in with Google\" onPress={onPress} />;\n * }\n * ```\n *\n * @platform iOS, Android - This hook only works on iOS and Android. On other platforms, it will throw an error.\n *\n * @returns An object containing the `startGoogleAuthenticationFlow` function that throws an error\n */\nexport function useSignInWithGoogle(): {\n startGoogleAuthenticationFlow: (\n startGoogleAuthenticationFlowParams?: StartGoogleAuthenticationFlowParams,\n ) => Promise<StartGoogleAuthenticationFlowReturnType>;\n} {\n function startGoogleAuthenticationFlow(\n _startGoogleAuthenticationFlowParams?: StartGoogleAuthenticationFlowParams,\n ): Promise<StartGoogleAuthenticationFlowReturnType> {\n return errorThrower.throw(\n 'Native Google Authentication is only available on iOS and Android. ' +\n 'For web and other platforms, please use the OAuth-based flow with useSSO and strategy: \"oauth_google\".',\n );\n }\n\n return {\n startGoogleAuthenticationFlow,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA6B;AAmDtB,SAAS,sBAId;AACA,WAAS,8BACP,sCACkD;AAClD,WAAO,2BAAa;AAAA,MAClB;AAAA,IAEF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,EACF;AACF;","names":[]}
@@ -1,29 +0,0 @@
1
- import type { ClientResource, SetActive } from '@clerk/shared/types';
2
- import type { StartGoogleAuthenticationFlowParams, StartGoogleAuthenticationFlowReturnType } from './useSignInWithGoogle.types';
3
- export type GoogleClientIds = {
4
- webClientId: string;
5
- iosClientId?: string;
6
- };
7
- export type GoogleAuthenticationFlowContext = {
8
- client: ClientResource;
9
- setActive: SetActive;
10
- };
11
- type PlatformConfig = {
12
- requiresIosClientId: boolean;
13
- };
14
- /**
15
- * Factory function to create the useSignInWithGoogle hook with platform-specific configuration.
16
- *
17
- * @internal
18
- */
19
- export declare function createUseSignInWithGoogle(platformConfig: PlatformConfig): () => {
20
- startGoogleAuthenticationFlow: (startGoogleAuthenticationFlowParams?: StartGoogleAuthenticationFlowParams) => Promise<StartGoogleAuthenticationFlowReturnType>;
21
- };
22
- /**
23
- * Core implementation of Google Authentication flow shared between iOS and Android.
24
- *
25
- * @internal
26
- */
27
- export declare function executeGoogleAuthenticationFlow(context: GoogleAuthenticationFlowContext, clientIds: GoogleClientIds, params?: StartGoogleAuthenticationFlowParams): Promise<StartGoogleAuthenticationFlowReturnType>;
28
- export {};
29
- //# sourceMappingURL=useSignInWithGoogle.shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSignInWithGoogle.shared.d.ts","sourceRoot":"","sources":["../../src/hooks/useSignInWithGoogle.shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrE,OAAO,KAAK,EACV,mCAAmC,EACnC,uCAAuC,EACxC,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AA+BF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,cAAc;0EAK5B,mCAAmC,KACxE,OAAO,CAAC,uCAAuC,CAAC;EAoCtD;AAED;;;;GAIG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,+BAA+B,EACxC,SAAS,EAAE,eAAe,EAC1B,MAAM,CAAC,EAAE,mCAAmC,GAC3C,OAAO,CAAC,uCAAuC,CAAC,CAmGlD"}
@@ -1,164 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var useSignInWithGoogle_shared_exports = {};
30
- __export(useSignInWithGoogle_shared_exports, {
31
- createUseSignInWithGoogle: () => createUseSignInWithGoogle,
32
- executeGoogleAuthenticationFlow: () => executeGoogleAuthenticationFlow
33
- });
34
- module.exports = __toCommonJS(useSignInWithGoogle_shared_exports);
35
- var import_react = require("@clerk/react");
36
- var import_error = require("@clerk/shared/error");
37
- var import_google_one_tap = require("../google-one-tap");
38
- var import_errors = require("../utils/errors");
39
- async function getGoogleClientIds() {
40
- var _a, _b, _c, _d;
41
- let webClientId;
42
- let iosClientId;
43
- try {
44
- const ConstantsModule = await import("expo-constants");
45
- const Constants = ConstantsModule.default;
46
- webClientId = ((_b = (_a = Constants == null ? void 0 : Constants.expoConfig) == null ? void 0 : _a.extra) == null ? void 0 : _b.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID) || process.env.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID;
47
- iosClientId = ((_d = (_c = Constants == null ? void 0 : Constants.expoConfig) == null ? void 0 : _c.extra) == null ? void 0 : _d.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID) || process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID;
48
- } catch {
49
- webClientId = process.env.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID;
50
- iosClientId = process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID;
51
- }
52
- return { webClientId, iosClientId };
53
- }
54
- function createUseSignInWithGoogle(platformConfig) {
55
- return function useSignInWithGoogle() {
56
- const clerk = (0, import_react.useClerk)();
57
- async function startGoogleAuthenticationFlow(startGoogleAuthenticationFlowParams) {
58
- const { client, loaded, setActive } = clerk;
59
- if (!loaded || !client) {
60
- return {
61
- createdSessionId: null,
62
- setActive
63
- };
64
- }
65
- const { webClientId, iosClientId } = await getGoogleClientIds();
66
- if (!webClientId) {
67
- return import_errors.errorThrower.throw(
68
- "Google Sign-In credentials not found. Please set EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID in your .env file."
69
- );
70
- }
71
- if (platformConfig.requiresIosClientId && !iosClientId) {
72
- return import_errors.errorThrower.throw(
73
- "Google Sign-In credentials not found. Please set EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID in your .env file."
74
- );
75
- }
76
- return executeGoogleAuthenticationFlow(
77
- { client, setActive },
78
- { webClientId, iosClientId },
79
- startGoogleAuthenticationFlowParams
80
- );
81
- }
82
- return {
83
- startGoogleAuthenticationFlow
84
- };
85
- };
86
- }
87
- async function executeGoogleAuthenticationFlow(context, clientIds, params) {
88
- var _a;
89
- const { client, setActive } = context;
90
- const { signIn, signUp } = client;
91
- import_google_one_tap.ClerkGoogleOneTapSignIn.configure(clientIds);
92
- const { randomUUID } = await import("expo-crypto");
93
- const nonce = randomUUID();
94
- try {
95
- const response = await import_google_one_tap.ClerkGoogleOneTapSignIn.presentExplicitSignIn({
96
- nonce
97
- });
98
- if (!(0, import_google_one_tap.isSuccessResponse)(response)) {
99
- return {
100
- createdSessionId: null,
101
- setActive,
102
- signIn,
103
- signUp
104
- };
105
- }
106
- const { idToken } = response.data;
107
- try {
108
- await signIn.create({
109
- strategy: "google_one_tap",
110
- token: idToken
111
- });
112
- const userNeedsToBeCreated = signIn.firstFactorVerification.status === "transferable";
113
- if (userNeedsToBeCreated) {
114
- await signUp.create({
115
- transfer: true,
116
- unsafeMetadata: params == null ? void 0 : params.unsafeMetadata
117
- });
118
- return {
119
- createdSessionId: signUp.createdSessionId,
120
- setActive,
121
- signIn,
122
- signUp
123
- };
124
- }
125
- return {
126
- createdSessionId: signIn.createdSessionId,
127
- setActive,
128
- signIn,
129
- signUp
130
- };
131
- } catch (signInError) {
132
- if ((0, import_error.isClerkAPIResponseError)(signInError) && ((_a = signInError.errors) == null ? void 0 : _a.some((err) => err.code === "external_account_not_found"))) {
133
- await signUp.create({
134
- strategy: "google_one_tap",
135
- token: idToken,
136
- unsafeMetadata: params == null ? void 0 : params.unsafeMetadata
137
- });
138
- return {
139
- createdSessionId: signUp.createdSessionId,
140
- setActive,
141
- signIn,
142
- signUp
143
- };
144
- }
145
- throw signInError;
146
- }
147
- } catch (error) {
148
- if ((0, import_google_one_tap.isErrorWithCode)(error) && error.code === "SIGN_IN_CANCELLED") {
149
- return {
150
- createdSessionId: null,
151
- setActive,
152
- signIn,
153
- signUp
154
- };
155
- }
156
- throw error;
157
- }
158
- }
159
- // Annotate the CommonJS export names for ESM import in node:
160
- 0 && (module.exports = {
161
- createUseSignInWithGoogle,
162
- executeGoogleAuthenticationFlow
163
- });
164
- //# sourceMappingURL=useSignInWithGoogle.shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useSignInWithGoogle.shared.ts"],"sourcesContent":["import { useClerk } from '@clerk/react';\nimport { isClerkAPIResponseError } from '@clerk/shared/error';\nimport type { ClientResource, SetActive } from '@clerk/shared/types';\n\nimport { ClerkGoogleOneTapSignIn, isErrorWithCode, isSuccessResponse } from '../google-one-tap';\nimport { errorThrower } from '../utils/errors';\nimport type {\n StartGoogleAuthenticationFlowParams,\n StartGoogleAuthenticationFlowReturnType,\n} from './useSignInWithGoogle.types';\n\nexport type GoogleClientIds = {\n webClientId: string;\n iosClientId?: string;\n};\n\nexport type GoogleAuthenticationFlowContext = {\n client: ClientResource;\n setActive: SetActive;\n};\n\ntype PlatformConfig = {\n requiresIosClientId: boolean;\n};\n\n/**\n * Helper to get Google client IDs from expo-constants or process.env.\n * Dynamically imports expo-constants to keep it optional.\n */\nasync function getGoogleClientIds(): Promise<{ webClientId?: string; iosClientId?: string }> {\n let webClientId: string | undefined;\n let iosClientId: string | undefined;\n\n // Try to get values from expo-constants first\n try {\n const ConstantsModule = await import('expo-constants');\n const Constants = ConstantsModule.default as {\n expoConfig?: { extra?: Record<string, string> };\n };\n webClientId =\n Constants?.expoConfig?.extra?.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID ||\n process.env.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID;\n iosClientId =\n Constants?.expoConfig?.extra?.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID ||\n process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID;\n } catch {\n // expo-constants not available, fall back to process.env only\n webClientId = process.env.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID;\n iosClientId = process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID;\n }\n\n return { webClientId, iosClientId };\n}\n\n/**\n * Factory function to create the useSignInWithGoogle hook with platform-specific configuration.\n *\n * @internal\n */\nexport function createUseSignInWithGoogle(platformConfig: PlatformConfig) {\n return function useSignInWithGoogle() {\n const clerk = useClerk();\n\n async function startGoogleAuthenticationFlow(\n startGoogleAuthenticationFlowParams?: StartGoogleAuthenticationFlowParams,\n ): Promise<StartGoogleAuthenticationFlowReturnType> {\n const { client, loaded, setActive } = clerk;\n\n if (!loaded || !client) {\n return {\n createdSessionId: null,\n setActive,\n };\n }\n\n // Get environment variables from expo-constants or process.env\n const { webClientId, iosClientId } = await getGoogleClientIds();\n\n if (!webClientId) {\n return errorThrower.throw(\n 'Google Sign-In credentials not found. Please set EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID in your .env file.',\n );\n }\n\n if (platformConfig.requiresIosClientId && !iosClientId) {\n return errorThrower.throw(\n 'Google Sign-In credentials not found. Please set EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID in your .env file.',\n );\n }\n\n return executeGoogleAuthenticationFlow(\n { client, setActive },\n { webClientId, iosClientId },\n startGoogleAuthenticationFlowParams,\n );\n }\n\n return {\n startGoogleAuthenticationFlow,\n };\n };\n}\n\n/**\n * Core implementation of Google Authentication flow shared between iOS and Android.\n *\n * @internal\n */\nexport async function executeGoogleAuthenticationFlow(\n context: GoogleAuthenticationFlowContext,\n clientIds: GoogleClientIds,\n params?: StartGoogleAuthenticationFlowParams,\n): Promise<StartGoogleAuthenticationFlowReturnType> {\n const { client, setActive } = context;\n const { signIn, signUp } = client;\n\n // Configure Google Sign-In with client IDs\n ClerkGoogleOneTapSignIn.configure(clientIds);\n\n // Generate a cryptographic nonce for replay attack protection\n const { randomUUID } = await import('expo-crypto');\n const nonce = randomUUID();\n\n try {\n // Present Google Sign-In UI with nonce\n const response = await ClerkGoogleOneTapSignIn.presentExplicitSignIn({\n nonce,\n });\n\n // User cancelled\n if (!isSuccessResponse(response)) {\n return {\n createdSessionId: null,\n setActive,\n signIn,\n signUp,\n };\n }\n\n const { idToken } = response.data;\n\n try {\n // Try to sign in with the Google One Tap strategy\n await signIn.create({\n strategy: 'google_one_tap',\n token: idToken,\n });\n\n // Check if we need to transfer to SignUp (user doesn't exist yet)\n const userNeedsToBeCreated = signIn.firstFactorVerification.status === 'transferable';\n\n if (userNeedsToBeCreated) {\n // User doesn't exist - create a new SignUp with transfer\n await signUp.create({\n transfer: true,\n unsafeMetadata: params?.unsafeMetadata,\n });\n\n return {\n createdSessionId: signUp.createdSessionId,\n setActive,\n signIn,\n signUp,\n };\n }\n\n // User exists - return the SignIn session\n return {\n createdSessionId: signIn.createdSessionId,\n setActive,\n signIn,\n signUp,\n };\n } catch (signInError: unknown) {\n // Handle the case where the user doesn't exist (external_account_not_found)\n if (\n isClerkAPIResponseError(signInError) &&\n signInError.errors?.some(err => err.code === 'external_account_not_found')\n ) {\n // User doesn't exist - create a new SignUp with the token\n await signUp.create({\n strategy: 'google_one_tap',\n token: idToken,\n unsafeMetadata: params?.unsafeMetadata,\n });\n\n return {\n createdSessionId: signUp.createdSessionId,\n setActive,\n signIn,\n signUp,\n };\n }\n\n // Re-throw if it's a different error\n throw signInError;\n }\n } catch (error: unknown) {\n // Handle Google Sign-In cancellation errors\n if (isErrorWithCode(error) && error.code === 'SIGN_IN_CANCELLED') {\n return {\n createdSessionId: null,\n setActive,\n signIn,\n signUp,\n };\n }\n\n // Re-throw other errors\n throw error;\n }\n}\n"],"mappings":"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","names":[]}
@@ -1,11 +0,0 @@
1
- import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
2
- export type StartGoogleAuthenticationFlowParams = {
3
- unsafeMetadata?: SignUpUnsafeMetadata;
4
- };
5
- export type StartGoogleAuthenticationFlowReturnType = {
6
- createdSessionId: string | null;
7
- setActive?: SetActive;
8
- signIn?: SignInResource;
9
- signUp?: SignUpResource;
10
- };
11
- //# sourceMappingURL=useSignInWithGoogle.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSignInWithGoogle.types.d.ts","sourceRoot":"","sources":["../../src/hooks/useSignInWithGoogle.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErF,MAAM,MAAM,mCAAmC,GAAG;IAChD,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IACpD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var useSignInWithGoogle_types_exports = {};
16
- module.exports = __toCommonJS(useSignInWithGoogle_types_exports);
17
- //# sourceMappingURL=useSignInWithGoogle.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useSignInWithGoogle.types.ts"],"sourcesContent":["import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';\n\nexport type StartGoogleAuthenticationFlowParams = {\n unsafeMetadata?: SignUpUnsafeMetadata;\n};\n\nexport type StartGoogleAuthenticationFlowReturnType = {\n createdSessionId: string | null;\n setActive?: SetActive;\n signIn?: SignInResource;\n signUp?: SignUpResource;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,4 +0,0 @@
1
- import { type ConfigPlugin } from '@expo/config-plugins';
2
- declare const _default: ConfigPlugin<void>;
3
- export default _default;
4
- //# sourceMappingURL=withClerkExpo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"withClerkExpo.d.ts","sourceRoot":"","sources":["../../src/plugin/withClerkExpo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAsC,MAAM,sBAAsB,CAAC;;AA4C7F,wBAAiF"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var withClerkExpo_exports = {};
30
- __export(withClerkExpo_exports, {
31
- default: () => withClerkExpo_default
32
- });
33
- module.exports = __toCommonJS(withClerkExpo_exports);
34
- var import_config_plugins = require("@expo/config-plugins");
35
- var import_package = __toESM(require("../../package.json"));
36
- const withClerkGoogleSignIn = (config) => {
37
- var _a;
38
- const iosUrlScheme = process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME || ((_a = config.extra) == null ? void 0 : _a.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME);
39
- if (!iosUrlScheme) {
40
- return config;
41
- }
42
- return (0, import_config_plugins.withInfoPlist)(config, (modConfig) => {
43
- if (!Array.isArray(modConfig.modResults.CFBundleURLTypes)) {
44
- modConfig.modResults.CFBundleURLTypes = [];
45
- }
46
- const schemeExists = modConfig.modResults.CFBundleURLTypes.some(
47
- (urlType) => {
48
- var _a2;
49
- return (_a2 = urlType.CFBundleURLSchemes) == null ? void 0 : _a2.includes(iosUrlScheme);
50
- }
51
- );
52
- if (!schemeExists) {
53
- modConfig.modResults.CFBundleURLTypes.push({
54
- CFBundleURLSchemes: [iosUrlScheme]
55
- });
56
- }
57
- return modConfig;
58
- });
59
- };
60
- var withClerkExpo_default = (0, import_config_plugins.createRunOncePlugin)(withClerkGoogleSignIn, import_package.default.name, import_package.default.version);
61
- //# sourceMappingURL=withClerkExpo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/plugin/withClerkExpo.ts"],"sourcesContent":["import { type ConfigPlugin, createRunOncePlugin, withInfoPlist } from '@expo/config-plugins';\n\nimport pkg from '../../package.json';\n\n/**\n * Expo config plugin for @clerk/expo.\n *\n * This plugin configures the iOS URL scheme required for Google Sign-In.\n * The native Android module is automatically linked via expo-module.config.json.\n */\nconst withClerkGoogleSignIn: ConfigPlugin = config => {\n // Get the iOS URL scheme from environment or config.extra\n // We capture it here before entering the mod callback\n const iosUrlScheme =\n process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME ||\n (config as { extra?: Record<string, string> }).extra?.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME;\n\n if (!iosUrlScheme) {\n // No URL scheme configured, skip iOS configuration\n return config;\n }\n\n // Add iOS URL scheme for Google Sign-In\n return withInfoPlist(config, modConfig => {\n if (!Array.isArray(modConfig.modResults.CFBundleURLTypes)) {\n modConfig.modResults.CFBundleURLTypes = [];\n }\n\n // Check if the scheme is already added to avoid duplicates\n const schemeExists = modConfig.modResults.CFBundleURLTypes.some(urlType =>\n urlType.CFBundleURLSchemes?.includes(iosUrlScheme),\n );\n\n if (!schemeExists) {\n // Add Google Sign-In URL scheme\n modConfig.modResults.CFBundleURLTypes.push({\n CFBundleURLSchemes: [iosUrlScheme],\n });\n }\n\n return modConfig;\n });\n};\n\nexport default createRunOncePlugin(withClerkGoogleSignIn, pkg.name, pkg.version);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAsE;AAEtE,qBAAgB;AAQhB,MAAM,wBAAsC,YAAU;AAVtD;AAaE,QAAM,eACJ,QAAQ,IAAI,6CACX,YAA8C,UAA9C,mBAAqD;AAExD,MAAI,CAAC,cAAc;AAEjB,WAAO;AAAA,EACT;AAGA,aAAO,qCAAc,QAAQ,eAAa;AACxC,QAAI,CAAC,MAAM,QAAQ,UAAU,WAAW,gBAAgB,GAAG;AACzD,gBAAU,WAAW,mBAAmB,CAAC;AAAA,IAC3C;AAGA,UAAM,eAAe,UAAU,WAAW,iBAAiB;AAAA,MAAK,aAAQ;AA7B5E,YAAAA;AA8BM,gBAAAA,MAAA,QAAQ,uBAAR,gBAAAA,IAA4B,SAAS;AAAA;AAAA,IACvC;AAEA,QAAI,CAAC,cAAc;AAEjB,gBAAU,WAAW,iBAAiB,KAAK;AAAA,QACzC,oBAAoB,CAAC,YAAY;AAAA,MACnC,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,IAAO,4BAAQ,2CAAoB,uBAAuB,eAAAC,QAAI,MAAM,eAAAA,QAAI,OAAO;","names":["_a","pkg"]}
@@ -1,9 +0,0 @@
1
- {
2
- "platforms": ["android", "ios"],
3
- "android": {
4
- "modules": ["expo.modules.clerk.googlesignin.ClerkGoogleSignInModule"]
5
- },
6
- "ios": {
7
- "modules": ["ClerkGoogleSignInModule"]
8
- }
9
- }
@@ -1,22 +0,0 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = 'ClerkGoogleSignIn'
7
- s.version = package['version']
8
- s.summary = 'Native Google Sign-In module for Clerk Expo'
9
- s.description = 'Native Google Sign-In functionality using Google Sign-In SDK with nonce support for Clerk authentication'
10
- s.license = package['license']
11
- s.author = package['author']
12
- s.homepage = package['homepage']
13
- s.platforms = { :ios => '13.4' }
14
- s.swift_version = '5.4'
15
- s.source = { :git => 'https://github.com/clerk/javascript.git' }
16
- s.static_framework = true
17
-
18
- s.dependency 'ExpoModulesCore'
19
- s.dependency 'GoogleSignIn', '~> 9.0'
20
-
21
- s.source_files = '*.swift'
22
- end
@@ -1,229 +0,0 @@
1
- import ExpoModulesCore
2
- import GoogleSignIn
3
-
4
- public class ClerkGoogleSignInModule: Module {
5
- private var clientId: String?
6
- private var hostedDomain: String?
7
-
8
- public func definition() -> ModuleDefinition {
9
- Name("ClerkGoogleSignIn")
10
-
11
- // Configure the module
12
- Function("configure") { (params: ConfigureParams) in
13
- self.clientId = params.iosClientId ?? params.webClientId
14
- self.hostedDomain = params.hostedDomain
15
-
16
- // Set the configuration globally
17
- // clientID: iOS client ID for OAuth flow
18
- // serverClientID: Web client ID for token audience (what Clerk backend verifies)
19
- if let clientId = self.clientId {
20
- let config = GIDConfiguration(
21
- clientID: clientId,
22
- serverClientID: params.webClientId
23
- )
24
- GIDSignIn.sharedInstance.configuration = config
25
- }
26
- }
27
-
28
- // Sign in - attempts sign-in with hint if available
29
- AsyncFunction("signIn") { (params: SignInParams?, promise: Promise) in
30
- guard self.clientId != nil else {
31
- promise.reject(NotConfiguredException())
32
- return
33
- }
34
-
35
- DispatchQueue.main.async {
36
- guard let presentingVC = self.getPresentingViewController() else {
37
- promise.reject(GoogleSignInException(message: "No presenting view controller available"))
38
- return
39
- }
40
-
41
- // Build sign-in hint if filtering by authorized accounts
42
- let hint: String? = params?.filterByAuthorizedAccounts == true
43
- ? GIDSignIn.sharedInstance.currentUser?.profile?.email
44
- : nil
45
-
46
- GIDSignIn.sharedInstance.signIn(
47
- withPresenting: presentingVC,
48
- hint: hint,
49
- additionalScopes: nil,
50
- nonce: params?.nonce
51
- ) { result, error in
52
- self.handleSignInResult(result: result, error: error, promise: promise)
53
- }
54
- }
55
- }
56
-
57
- // Create account - shows account creation UI (same as sign in on iOS)
58
- AsyncFunction("createAccount") { (params: CreateAccountParams?, promise: Promise) in
59
- guard self.clientId != nil else {
60
- promise.reject(NotConfiguredException())
61
- return
62
- }
63
-
64
- DispatchQueue.main.async {
65
- guard let presentingVC = self.getPresentingViewController() else {
66
- promise.reject(GoogleSignInException(message: "No presenting view controller available"))
67
- return
68
- }
69
-
70
- GIDSignIn.sharedInstance.signIn(
71
- withPresenting: presentingVC,
72
- hint: nil,
73
- additionalScopes: nil,
74
- nonce: params?.nonce
75
- ) { result, error in
76
- self.handleSignInResult(result: result, error: error, promise: promise)
77
- }
78
- }
79
- }
80
-
81
- // Explicit sign-in - uses standard Google Sign-In flow
82
- AsyncFunction("presentExplicitSignIn") { (params: ExplicitSignInParams?, promise: Promise) in
83
- guard self.clientId != nil else {
84
- promise.reject(NotConfiguredException())
85
- return
86
- }
87
-
88
- DispatchQueue.main.async {
89
- guard let presentingVC = self.getPresentingViewController() else {
90
- promise.reject(GoogleSignInException(message: "No presenting view controller available"))
91
- return
92
- }
93
-
94
- GIDSignIn.sharedInstance.signIn(
95
- withPresenting: presentingVC,
96
- hint: nil,
97
- additionalScopes: nil,
98
- nonce: params?.nonce
99
- ) { result, error in
100
- self.handleSignInResult(result: result, error: error, promise: promise)
101
- }
102
- }
103
- }
104
-
105
- // Sign out - clears credential state
106
- AsyncFunction("signOut") { (promise: Promise) in
107
- GIDSignIn.sharedInstance.signOut()
108
- promise.resolve(nil)
109
- }
110
- }
111
-
112
- private func getPresentingViewController() -> UIViewController? {
113
- guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
114
- let window = scene.windows.first,
115
- let rootVC = window.rootViewController else {
116
- return nil
117
- }
118
-
119
- var topVC = rootVC
120
- while let presentedVC = topVC.presentedViewController {
121
- topVC = presentedVC
122
- }
123
- return topVC
124
- }
125
-
126
- private func handleSignInResult(result: GIDSignInResult?, error: Error?, promise: Promise) {
127
- if let error = error {
128
- let nsError = error as NSError
129
-
130
- // Check for user cancellation
131
- if nsError.domain == kGIDSignInErrorDomain && nsError.code == GIDSignInError.canceled.rawValue {
132
- promise.reject(SignInCancelledException())
133
- return
134
- }
135
-
136
- promise.reject(GoogleSignInException(message: error.localizedDescription))
137
- return
138
- }
139
-
140
- guard let result = result,
141
- let idToken = result.user.idToken?.tokenString else {
142
- promise.reject(GoogleSignInException(message: "No ID token received"))
143
- return
144
- }
145
-
146
- let user = result.user
147
- let profile = user.profile
148
-
149
- let response: [String: Any] = [
150
- "type": "success",
151
- "data": [
152
- "idToken": idToken,
153
- "user": [
154
- "id": user.userID ?? "",
155
- "email": profile?.email ?? "",
156
- "name": profile?.name ?? "",
157
- "givenName": profile?.givenName ?? "",
158
- "familyName": profile?.familyName ?? "",
159
- "photo": profile?.imageURL(withDimension: 200)?.absoluteString ?? NSNull()
160
- ] as [String: Any]
161
- ] as [String: Any]
162
- ]
163
-
164
- promise.resolve(response)
165
- }
166
- }
167
-
168
- // MARK: - Records
169
-
170
- struct ConfigureParams: Record {
171
- @Field
172
- var webClientId: String = ""
173
-
174
- @Field
175
- var iosClientId: String?
176
-
177
- @Field
178
- var hostedDomain: String?
179
-
180
- @Field
181
- var autoSelectEnabled: Bool?
182
- }
183
-
184
- struct SignInParams: Record {
185
- @Field
186
- var nonce: String?
187
-
188
- @Field
189
- var filterByAuthorizedAccounts: Bool?
190
- }
191
-
192
- struct CreateAccountParams: Record {
193
- @Field
194
- var nonce: String?
195
- }
196
-
197
- struct ExplicitSignInParams: Record {
198
- @Field
199
- var nonce: String?
200
- }
201
-
202
- // MARK: - Exceptions
203
-
204
- class SignInCancelledException: Exception {
205
- override var code: String { "SIGN_IN_CANCELLED" }
206
- override var reason: String { "User cancelled the sign-in flow" }
207
- }
208
-
209
- class NoSavedCredentialException: Exception {
210
- override var code: String { "NO_SAVED_CREDENTIAL_FOUND" }
211
- override var reason: String { "No saved credential found" }
212
- }
213
-
214
- class NotConfiguredException: Exception {
215
- override var code: String { "NOT_CONFIGURED" }
216
- override var reason: String { "Google Sign-In is not configured. Call configure() first." }
217
- }
218
-
219
- class GoogleSignInException: Exception {
220
- private let errorMessage: String
221
-
222
- init(message: String) {
223
- self.errorMessage = message
224
- super.init()
225
- }
226
-
227
- override var code: String { "GOOGLE_SIGN_IN_ERROR" }
228
- override var reason: String { errorMessage }
229
- }