@clerk/expo 3.0.0-snapshot.v20251216175437 → 3.0.0-snapshot.v20251217162523

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 +12 -33
  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 -104
  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 -139
  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 -47
  26. package/dist/hooks/useSignInWithGoogle.android.d.ts.map +0 -1
  27. package/dist/hooks/useSignInWithGoogle.android.js +0 -65
  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 -47
  32. package/dist/hooks/useSignInWithGoogle.ios.d.ts.map +0 -1
  33. package/dist/hooks/useSignInWithGoogle.ios.js +0 -70
  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 -17
  38. package/dist/hooks/useSignInWithGoogle.shared.d.ts.map +0 -1
  39. package/dist/hooks/useSignInWithGoogle.shared.js +0 -112
  40. package/dist/hooks/useSignInWithGoogle.shared.js.map +0 -1
  41. package/dist/hooks/useSignInWithGoogle.types.d.ts +0 -12
  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/expo-module.config.json +0 -9
  46. package/ios/ClerkGoogleSignIn.podspec +0 -22
  47. package/ios/ClerkGoogleSignInModule.swift +0 -229
  48. package/plugin/build/withClerkExpo.d.ts +0 -3
  49. package/plugin/build/withClerkExpo.js +0 -36
  50. package/plugin/src/withClerkExpo.ts +0 -45
  51. package/plugin/tsconfig.json +0 -15
@@ -1,70 +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_ios_exports = {};
30
- __export(useSignInWithGoogle_ios_exports, {
31
- useSignInWithGoogle: () => useSignInWithGoogle
32
- });
33
- module.exports = __toCommonJS(useSignInWithGoogle_ios_exports);
34
- var import_react = require("@clerk/react");
35
- var import_expo_constants = __toESM(require("expo-constants"));
36
- var import_errors = require("../utils/errors");
37
- var import_useSignInWithGoogle = require("./useSignInWithGoogle.shared");
38
- function useSignInWithGoogle() {
39
- const clerk = (0, import_react.useClerk)();
40
- async function startGoogleAuthenticationFlow(startGoogleAuthenticationFlowParams) {
41
- var _a, _b, _c, _d;
42
- const { client, loaded, setActive } = clerk;
43
- if (!loaded || !client) {
44
- return {
45
- createdSessionId: null,
46
- setActive
47
- };
48
- }
49
- const webClientId = ((_b = (_a = import_expo_constants.default.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;
50
- const iosClientId = ((_d = (_c = import_expo_constants.default.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;
51
- if (!webClientId || !iosClientId) {
52
- return import_errors.errorThrower.throw(
53
- "Google Sign-In credentials not found. Please set EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID and EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID in your .env file."
54
- );
55
- }
56
- return (0, import_useSignInWithGoogle.executeGoogleAuthenticationFlow)(
57
- { client, setActive },
58
- { webClientId, iosClientId },
59
- startGoogleAuthenticationFlowParams
60
- );
61
- }
62
- return {
63
- startGoogleAuthenticationFlow
64
- };
65
- }
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- useSignInWithGoogle
69
- });
70
- //# sourceMappingURL=useSignInWithGoogle.ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useSignInWithGoogle.ios.ts"],"sourcesContent":["import { useClerk } from '@clerk/react';\nimport Constants from 'expo-constants';\n\nimport { errorThrower } from '../utils/errors';\nimport { executeGoogleAuthenticationFlow } from './useSignInWithGoogle.shared';\nimport type {\n StartGoogleAuthenticationFlowParams,\n StartGoogleAuthenticationFlowReturnType,\n} from './useSignInWithGoogle.types';\n\nexport type { StartGoogleAuthenticationFlowParams, StartGoogleAuthenticationFlowReturnType };\n\n/**\n * Hook for native Google Authentication on iOS using Clerk's built-in Google Sign-In module.\n *\n * This hook provides a simplified way to authenticate users with their Google account\n * using the native iOS Google Sign-In UI. The authentication flow automatically\n * handles the ID token exchange with Clerk's backend and manages the transfer flow\n * between sign-in and sign-up.\n *\n * Features:\n * - Native Google Sign-In UI\n * - Built-in nonce support for replay attack protection\n * - No additional dependencies required\n *\n * @example\n * ```tsx\n * import { useSignInWithGoogle } from '@clerk/clerk-expo';\n * import { Button } from 'react-native';\n *\n * function GoogleSigninButton() {\n * const { startGoogleAuthenticationFlow } = useSignInWithGoogle();\n *\n * const onPress = async () => {\n * try {\n * const { createdSessionId, setActive } = await startGoogleAuthenticationFlow();\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 - This is the iOS-specific implementation using Google Sign-In SDK\n *\n * @returns An object containing the `startGoogleAuthenticationFlow` function\n */\nexport 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\n const webClientId =\n Constants.expoConfig?.extra?.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID ||\n process.env.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID;\n const iosClientId =\n Constants.expoConfig?.extra?.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID ||\n process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID;\n\n if (!webClientId || !iosClientId) {\n return errorThrower.throw(\n 'Google Sign-In credentials not found. Please set EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID and 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyB;AACzB,4BAAsB;AAEtB,oBAA6B;AAC7B,iCAAgD;AAiDzC,SAAS,sBAAsB;AACpC,QAAM,YAAQ,uBAAS;AAEvB,iBAAe,8BACb,qCACkD;AA1DtD;AA2DI,UAAM,EAAE,QAAQ,QAAQ,UAAU,IAAI;AAEtC,QAAI,CAAC,UAAU,CAAC,QAAQ;AACtB,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAGA,UAAM,gBACJ,iCAAAA,QAAU,eAAV,mBAAsB,UAAtB,mBAA6B,2CAC7B,QAAQ,IAAI;AACd,UAAM,gBACJ,iCAAAA,QAAU,eAAV,mBAAsB,UAAtB,mBAA6B,2CAC7B,QAAQ,IAAI;AAEd,QAAI,CAAC,eAAe,CAAC,aAAa;AAChC,aAAO,2BAAa;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAEA,eAAO;AAAA,MACL,EAAE,QAAQ,UAAU;AAAA,MACpB,EAAE,aAAa,YAAY;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,EACF;AACF;","names":["Constants"]}
@@ -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,17 +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
- /**
12
- * Core implementation of Google Authentication flow shared between iOS and Android.
13
- *
14
- * @internal
15
- */
16
- export declare function executeGoogleAuthenticationFlow(context: GoogleAuthenticationFlowContext, clientIds: GoogleClientIds, params?: StartGoogleAuthenticationFlowParams): Promise<StartGoogleAuthenticationFlowReturnType>;
17
- //# 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":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrE,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;;;;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,112 +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
- executeGoogleAuthenticationFlow: () => executeGoogleAuthenticationFlow
32
- });
33
- module.exports = __toCommonJS(useSignInWithGoogle_shared_exports);
34
- var import_error = require("@clerk/shared/error");
35
- var import_google_one_tap = require("../google-one-tap");
36
- async function executeGoogleAuthenticationFlow(context, clientIds, params) {
37
- var _a;
38
- const { client, setActive } = context;
39
- const { signIn, signUp } = client;
40
- import_google_one_tap.ClerkGoogleOneTapSignIn.configure(clientIds);
41
- const { randomUUID } = await import("expo-crypto");
42
- const nonce = randomUUID();
43
- try {
44
- const response = await import_google_one_tap.ClerkGoogleOneTapSignIn.presentExplicitSignIn({
45
- nonce
46
- });
47
- if (!(0, import_google_one_tap.isSuccessResponse)(response)) {
48
- return {
49
- createdSessionId: null,
50
- setActive,
51
- signIn,
52
- signUp
53
- };
54
- }
55
- const { idToken } = response.data;
56
- try {
57
- await signIn.create({
58
- strategy: "google_one_tap",
59
- token: idToken
60
- });
61
- const userNeedsToBeCreated = signIn.firstFactorVerification.status === "transferable";
62
- if (userNeedsToBeCreated) {
63
- await signUp.create({
64
- transfer: true,
65
- unsafeMetadata: params == null ? void 0 : params.unsafeMetadata
66
- });
67
- return {
68
- createdSessionId: signUp.createdSessionId,
69
- setActive,
70
- signIn,
71
- signUp
72
- };
73
- }
74
- return {
75
- createdSessionId: signIn.createdSessionId,
76
- setActive,
77
- signIn,
78
- signUp
79
- };
80
- } catch (signInError) {
81
- if ((0, import_error.isClerkAPIResponseError)(signInError) && ((_a = signInError.errors) == null ? void 0 : _a.some((err) => err.code === "external_account_not_found"))) {
82
- await signUp.create({
83
- strategy: "google_one_tap",
84
- token: idToken,
85
- unsafeMetadata: params == null ? void 0 : params.unsafeMetadata
86
- });
87
- return {
88
- createdSessionId: signUp.createdSessionId,
89
- setActive,
90
- signIn,
91
- signUp
92
- };
93
- }
94
- throw signInError;
95
- }
96
- } catch (error) {
97
- if ((0, import_google_one_tap.isErrorWithCode)(error) && error.code === "SIGN_IN_CANCELLED") {
98
- return {
99
- createdSessionId: null,
100
- setActive,
101
- signIn,
102
- signUp
103
- };
104
- }
105
- throw error;
106
- }
107
- }
108
- // Annotate the CommonJS export names for ESM import in node:
109
- 0 && (module.exports = {
110
- executeGoogleAuthenticationFlow
111
- });
112
- //# sourceMappingURL=useSignInWithGoogle.shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useSignInWithGoogle.shared.ts"],"sourcesContent":["import { isClerkAPIResponseError } from '@clerk/shared/error';\nimport type { ClientResource, SetActive } from '@clerk/shared/types';\n\nimport { ClerkGoogleOneTapSignIn, isErrorWithCode, isSuccessResponse } from '../google-one-tap';\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAwC;AAGxC,4BAA4E;AAqB5E,eAAsB,gCACpB,SACA,WACA,QACkD;AA5BpD;AA6BE,QAAM,EAAE,QAAQ,UAAU,IAAI;AAC9B,QAAM,EAAE,QAAQ,OAAO,IAAI;AAG3B,gDAAwB,UAAU,SAAS;AAG3C,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,aAAa;AACjD,QAAM,QAAQ,WAAW;AAEzB,MAAI;AAEF,UAAM,WAAW,MAAM,8CAAwB,sBAAsB;AAAA,MACnE;AAAA,IACF,CAAC;AAGD,QAAI,KAAC,yCAAkB,QAAQ,GAAG;AAChC,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,UAAM,EAAE,QAAQ,IAAI,SAAS;AAE7B,QAAI;AAEF,YAAM,OAAO,OAAO;AAAA,QAClB,UAAU;AAAA,QACV,OAAO;AAAA,MACT,CAAC;AAGD,YAAM,uBAAuB,OAAO,wBAAwB,WAAW;AAEvE,UAAI,sBAAsB;AAExB,cAAM,OAAO,OAAO;AAAA,UAClB,UAAU;AAAA,UACV,gBAAgB,iCAAQ;AAAA,QAC1B,CAAC;AAED,eAAO;AAAA,UACL,kBAAkB,OAAO;AAAA,UACzB;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAGA,aAAO;AAAA,QACL,kBAAkB,OAAO;AAAA,QACzB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,SAAS,aAAsB;AAE7B,cACE,sCAAwB,WAAW,OACnC,iBAAY,WAAZ,mBAAoB,KAAK,SAAO,IAAI,SAAS,gCAC7C;AAEA,cAAM,OAAO,OAAO;AAAA,UAClB,UAAU;AAAA,UACV,OAAO;AAAA,UACP,gBAAgB,iCAAQ;AAAA,QAC1B,CAAC;AAED,eAAO;AAAA,UACL,kBAAkB,OAAO;AAAA,UACzB;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAGA,YAAM;AAAA,IACR;AAAA,EACF,SAAS,OAAgB;AAEvB,YAAI,uCAAgB,KAAK,KAAK,MAAM,SAAS,qBAAqB;AAChE,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAGA,UAAM;AAAA,EACR;AACF;","names":[]}
@@ -1,12 +0,0 @@
1
- import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
2
- export type SignUpUnsafeMetadata = Record<string, unknown>;
3
- export type StartGoogleAuthenticationFlowParams = {
4
- unsafeMetadata?: SignUpUnsafeMetadata;
5
- };
6
- export type StartGoogleAuthenticationFlowReturnType = {
7
- createdSessionId: string | null;
8
- setActive?: SetActive;
9
- signIn?: SignInResource;
10
- signUp?: SignUpResource;
11
- };
12
- //# 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,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3D,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 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"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import { type ConfigPlugin } from '@expo/config-plugins';
2
- declare const _default: ConfigPlugin<void>;
3
- export default _default;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_plugins_1 = require("@expo/config-plugins");
4
- const pkg = require('@clerk/expo/package.json');
5
- /**
6
- * Expo config plugin for @clerk/expo.
7
- *
8
- * This plugin configures the iOS URL scheme required for Google Sign-In.
9
- * The native Android module is automatically linked via expo-module.config.json.
10
- */
11
- const withClerkGoogleSignIn = config => {
12
- // Get the iOS URL scheme from environment or config.extra
13
- // We capture it here before entering the mod callback
14
- const iosUrlScheme = process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME ||
15
- config.extra?.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME;
16
- if (!iosUrlScheme) {
17
- // No URL scheme configured, skip iOS configuration
18
- return config;
19
- }
20
- // Add iOS URL scheme for Google Sign-In
21
- return (0, config_plugins_1.withInfoPlist)(config, modConfig => {
22
- if (!Array.isArray(modConfig.modResults.CFBundleURLTypes)) {
23
- modConfig.modResults.CFBundleURLTypes = [];
24
- }
25
- // Check if the scheme is already added to avoid duplicates
26
- const schemeExists = modConfig.modResults.CFBundleURLTypes.some(urlType => urlType.CFBundleURLSchemes?.includes(iosUrlScheme));
27
- if (!schemeExists) {
28
- // Add Google Sign-In URL scheme
29
- modConfig.modResults.CFBundleURLTypes.push({
30
- CFBundleURLSchemes: [iosUrlScheme],
31
- });
32
- }
33
- return modConfig;
34
- });
35
- };
36
- exports.default = (0, config_plugins_1.createRunOncePlugin)(withClerkGoogleSignIn, pkg.name, pkg.version);
@@ -1,45 +0,0 @@
1
- import { createRunOncePlugin, withInfoPlist, type ConfigPlugin } from '@expo/config-plugins';
2
-
3
- const pkg = require('@clerk/expo/package.json');
4
-
5
- /**
6
- * Expo config plugin for @clerk/expo.
7
- *
8
- * This plugin configures the iOS URL scheme required for Google Sign-In.
9
- * The native Android module is automatically linked via expo-module.config.json.
10
- */
11
- const withClerkGoogleSignIn: ConfigPlugin = config => {
12
- // Get the iOS URL scheme from environment or config.extra
13
- // We capture it here before entering the mod callback
14
- const iosUrlScheme =
15
- process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME ||
16
- (config as { extra?: Record<string, string> }).extra?.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME;
17
-
18
- if (!iosUrlScheme) {
19
- // No URL scheme configured, skip iOS configuration
20
- return config;
21
- }
22
-
23
- // Add iOS URL scheme for Google Sign-In
24
- return withInfoPlist(config, modConfig => {
25
- if (!Array.isArray(modConfig.modResults.CFBundleURLTypes)) {
26
- modConfig.modResults.CFBundleURLTypes = [];
27
- }
28
-
29
- // Check if the scheme is already added to avoid duplicates
30
- const schemeExists = modConfig.modResults.CFBundleURLTypes.some(urlType =>
31
- urlType.CFBundleURLSchemes?.includes(iosUrlScheme),
32
- );
33
-
34
- if (!schemeExists) {
35
- // Add Google Sign-In URL scheme
36
- modConfig.modResults.CFBundleURLTypes.push({
37
- CFBundleURLSchemes: [iosUrlScheme],
38
- });
39
- }
40
-
41
- return modConfig;
42
- });
43
- };
44
-
45
- export default createRunOncePlugin(withClerkGoogleSignIn, pkg.name, pkg.version);