@clerk/expo 4.0.0-snapshot.v20260720201619 → 4.0.0
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/dist/google/index.d.ts +2 -2
- package/dist/google/index.d.ts.map +1 -1
- package/dist/google/index.js +2 -2
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.d.ts +86 -0
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.d.ts.map +1 -0
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.js +154 -0
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.js.map +1 -0
- package/dist/google-one-tap/index.d.ts +3 -0
- package/dist/google-one-tap/index.d.ts.map +1 -0
- package/dist/google-one-tap/index.js +33 -0
- package/dist/google-one-tap/types.d.ts +161 -0
- package/dist/google-one-tap/types.d.ts.map +1 -0
- package/dist/google-one-tap/types.js +0 -0
- package/dist/hooks/useSignInWithGoogle.android.d.ts +48 -0
- package/dist/hooks/useSignInWithGoogle.android.d.ts.map +1 -0
- package/dist/hooks/useSignInWithGoogle.android.js +52 -0
- package/dist/hooks/useSignInWithGoogle.android.js.map +1 -0
- package/dist/hooks/useSignInWithGoogle.d.ts +55 -0
- package/dist/hooks/useSignInWithGoogle.d.ts.map +1 -0
- package/dist/hooks/useSignInWithGoogle.ios.d.ts +48 -0
- package/dist/hooks/useSignInWithGoogle.ios.d.ts.map +1 -0
- package/dist/hooks/useSignInWithGoogle.ios.js +52 -0
- package/dist/hooks/useSignInWithGoogle.ios.js.map +1 -0
- package/dist/hooks/useSignInWithGoogle.js +53 -0
- package/dist/hooks/useSignInWithGoogle.js.map +1 -0
- package/dist/hooks/useSignInWithGoogle.shared.d.ts +29 -0
- package/dist/hooks/useSignInWithGoogle.shared.d.ts.map +1 -0
- package/dist/hooks/useSignInWithGoogle.shared.js +131 -0
- package/dist/hooks/useSignInWithGoogle.shared.js.map +1 -0
- package/dist/hooks/useSignInWithGoogle.types.d.ts +11 -0
- package/dist/hooks/useSignInWithGoogle.types.d.ts.map +1 -0
- package/dist/hooks/useSignInWithGoogle.types.js +0 -0
- package/dist/node_modules/.pnpm/{@expo_config-plugins@54.0.4 → @expo_config-plugins@54.0.5}/node_modules/@expo/config-plugins/build/index.d.ts +25 -25
- package/dist/node_modules/.pnpm/{@expo_config-plugins@54.0.4 → @expo_config-plugins@54.0.5}/node_modules/@expo/config-plugins/build/index.js +67 -233
- package/dist/node_modules/.pnpm/@expo_config-plugins@54.0.5/node_modules/@expo/config-plugins/build/index.js.map +1 -0
- package/dist/plugin/withClerkExpo.js +1 -1
- package/dist/provider/ClerkProvider.js +1 -1
- package/dist/specs/NativeClerkGoogleSignIn.android.d.ts +11 -0
- package/dist/specs/NativeClerkGoogleSignIn.android.d.ts.map +1 -0
- package/dist/specs/NativeClerkGoogleSignIn.android.js +8 -0
- package/dist/specs/NativeClerkGoogleSignIn.android.js.map +1 -0
- package/dist/specs/NativeClerkGoogleSignIn.d.ts +11 -0
- package/dist/specs/NativeClerkGoogleSignIn.d.ts.map +1 -0
- package/dist/specs/NativeClerkGoogleSignIn.js +8 -0
- package/dist/specs/NativeClerkGoogleSignIn.js.map +1 -0
- package/dist/specs/NativeClerkModule.android.d.ts +1 -1
- package/dist/specs/NativeClerkModule.android.d.ts.map +1 -1
- package/dist/specs/NativeClerkModule.android.js +1 -1
- package/dist/specs/NativeClerkModule.android.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/specs/NativeClerkGoogleSignIn.android.ts +15 -0
- package/src/specs/NativeClerkGoogleSignIn.ts +13 -0
- package/src/specs/NativeClerkModule.android.ts +3 -2
- package/src/specs/__tests__/androidSpecs.test.ts +51 -0
- package/dist/node_modules/.pnpm/@expo_config-plugins@54.0.4/node_modules/@expo/config-plugins/build/index.js.map +0 -1
package/dist/google/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useSignInWithGoogle } from '
|
|
2
|
-
export type { StartGoogleAuthenticationFlowParams, StartGoogleAuthenticationFlowReturnType, } from '
|
|
1
|
+
export { useSignInWithGoogle } from '../hooks/useSignInWithGoogle';
|
|
2
|
+
export type { StartGoogleAuthenticationFlowParams, StartGoogleAuthenticationFlowReturnType, } from '../hooks/useSignInWithGoogle.types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/google/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/google/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,YAAY,EACV,mCAAmC,EACnC,uCAAuC,GACxC,MAAM,oCAAoC,CAAC"}
|
package/dist/google/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
let
|
|
2
|
+
let src_hooks_useSignInWithGoogle = require("../hooks/useSignInWithGoogle");
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, 'useSignInWithGoogle', {
|
|
5
5
|
enumerable: true,
|
|
6
6
|
get: function () {
|
|
7
|
-
return
|
|
7
|
+
return src_hooks_useSignInWithGoogle.useSignInWithGoogle;
|
|
8
8
|
}
|
|
9
9
|
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { CancelledResponse, ConfigureParams, CreateAccountParams, ExplicitSignInParams, NoSavedCredentialFound, OneTapResponse, OneTapSuccessResponse, SignInParams } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a response indicates the user cancelled the sign-in flow.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isCancelledResponse(response: OneTapResponse): response is CancelledResponse;
|
|
6
|
+
/**
|
|
7
|
+
* Check if a response indicates no saved credential was found.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNoSavedCredentialFoundResponse(response: OneTapResponse): response is NoSavedCredentialFound;
|
|
10
|
+
/**
|
|
11
|
+
* Check if a response is a successful sign-in.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isSuccessResponse(response: OneTapResponse): response is OneTapSuccessResponse;
|
|
14
|
+
/**
|
|
15
|
+
* Check if an error has code and message properties (Google Sign-In error).
|
|
16
|
+
*/
|
|
17
|
+
export declare function isErrorWithCode(error: unknown): error is {
|
|
18
|
+
code: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Internal Google One Tap Sign-In module.
|
|
23
|
+
*
|
|
24
|
+
* This module provides native Google Sign-In functionality using Google's
|
|
25
|
+
* Credential Manager API with full nonce support for replay attack protection.
|
|
26
|
+
*
|
|
27
|
+
* @internal This is an internal module. Use the `useSignInWithGoogle` hook instead.
|
|
28
|
+
* @platform Android, iOS
|
|
29
|
+
*/
|
|
30
|
+
export declare const ClerkGoogleOneTapSignIn: {
|
|
31
|
+
/**
|
|
32
|
+
* Configure Google Sign-In. Must be called before any sign-in methods.
|
|
33
|
+
*
|
|
34
|
+
* @param params - Configuration parameters
|
|
35
|
+
* @param params.webClientId - The web client ID from Google Cloud Console (required)
|
|
36
|
+
* @param params.hostedDomain - Optional domain restriction
|
|
37
|
+
* @param params.autoSelectEnabled - Auto-select for single credential (default: false)
|
|
38
|
+
*/
|
|
39
|
+
configure(params: ConfigureParams): void;
|
|
40
|
+
/**
|
|
41
|
+
* Attempt to sign in with saved credentials (One Tap).
|
|
42
|
+
*
|
|
43
|
+
* This method will show the One Tap UI if there are saved credentials,
|
|
44
|
+
* or return a "noSavedCredentialFound" response if there are none.
|
|
45
|
+
*
|
|
46
|
+
* @param params - Sign-in parameters
|
|
47
|
+
* @param params.nonce - Cryptographic nonce for replay protection
|
|
48
|
+
* @param params.filterByAuthorizedAccounts - Android only. Filter to previously authorized accounts.
|
|
49
|
+
* @param params.hint - iOS only. Hint for Google Sign-In.
|
|
50
|
+
*
|
|
51
|
+
* @returns Promise resolving to OneTapResponse
|
|
52
|
+
*/
|
|
53
|
+
signIn(params?: SignInParams): Promise<OneTapResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Create a new account (shows all Google accounts).
|
|
56
|
+
*
|
|
57
|
+
* This method shows the account picker with all available Google accounts,
|
|
58
|
+
* not just previously authorized ones.
|
|
59
|
+
*
|
|
60
|
+
* @param params - Create account parameters
|
|
61
|
+
* @param params.nonce - Cryptographic nonce for replay protection
|
|
62
|
+
*
|
|
63
|
+
* @returns Promise resolving to OneTapResponse
|
|
64
|
+
*/
|
|
65
|
+
createAccount(params?: CreateAccountParams): Promise<OneTapResponse>;
|
|
66
|
+
/**
|
|
67
|
+
* Present explicit sign-in UI (Google Sign-In button flow).
|
|
68
|
+
*
|
|
69
|
+
* This shows the full Google Sign-In UI, similar to clicking a
|
|
70
|
+
* "Sign in with Google" button.
|
|
71
|
+
*
|
|
72
|
+
* @param params - Explicit sign-in parameters
|
|
73
|
+
* @param params.nonce - Cryptographic nonce for replay protection
|
|
74
|
+
*
|
|
75
|
+
* @returns Promise resolving to OneTapResponse
|
|
76
|
+
*/
|
|
77
|
+
presentExplicitSignIn(params?: ExplicitSignInParams): Promise<OneTapResponse>;
|
|
78
|
+
/**
|
|
79
|
+
* Sign out and clear credential state.
|
|
80
|
+
*
|
|
81
|
+
* This disables automatic sign-in until the user signs in again.
|
|
82
|
+
*/
|
|
83
|
+
signOut(): Promise<void>;
|
|
84
|
+
};
|
|
85
|
+
export type { ConfigureParams, SignInParams, CreateAccountParams, ExplicitSignInParams, OneTapResponse, OneTapSuccessResponse, CancelledResponse, NoSavedCredentialFound, GoogleUser, } from './types';
|
|
86
|
+
//# sourceMappingURL=ClerkGoogleOneTapSignIn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClerkGoogleOneTapSignIn.d.ts","sourceRoot":"","sources":["../../src/google-one-tap/ClerkGoogleOneTapSignIn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACb,MAAM,SAAS,CAAC;AAajB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,IAAI,iBAAiB,CAE3F;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,IAAI,sBAAsB,CAE7G;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,IAAI,qBAAqB,CAE7F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAS1F;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;;;;OAOG;sBACe,eAAe,GAAG,IAAI;IAIxC;;;;;;;;;;;;OAYG;oBACmB,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAgB5D;;;;;;;;;;OAUG;2BAC0B,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAgB1E;;;;;;;;;;OAUG;mCACkC,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAanF;;;;OAIG;eACc,OAAO,CAAC,IAAI,CAAC;CAG/B,CAAC;AAEF,YAAY,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,GACX,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
|
+
let src_specs_NativeClerkGoogleSignIn = require("../specs/NativeClerkGoogleSignIn");
|
|
4
|
+
src_specs_NativeClerkGoogleSignIn = require_runtime.__toESM(src_specs_NativeClerkGoogleSignIn);
|
|
5
|
+
|
|
6
|
+
//#region src/google-one-tap/ClerkGoogleOneTapSignIn.ts
|
|
7
|
+
function getNativeModule() {
|
|
8
|
+
if (!src_specs_NativeClerkGoogleSignIn.default) throw new Error("ClerkGoogleSignIn native module is not available. Install @clerk/expo-google-signin (npx expo install @clerk/expo-google-signin), add \"@clerk/expo-google-signin\" to the plugins array in your app config, then rebuild your native app.");
|
|
9
|
+
return src_specs_NativeClerkGoogleSignIn.default;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check if a response indicates the user cancelled the sign-in flow.
|
|
13
|
+
*/
|
|
14
|
+
function isCancelledResponse(response) {
|
|
15
|
+
return response.type === "cancelled";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if a response indicates no saved credential was found.
|
|
19
|
+
*/
|
|
20
|
+
function isNoSavedCredentialFoundResponse(response) {
|
|
21
|
+
return response.type === "noSavedCredentialFound";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if a response is a successful sign-in.
|
|
25
|
+
*/
|
|
26
|
+
function isSuccessResponse(response) {
|
|
27
|
+
return response.type === "success";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if an error has code and message properties (Google Sign-In error).
|
|
31
|
+
*/
|
|
32
|
+
function isErrorWithCode(error) {
|
|
33
|
+
return error !== null && typeof error === "object" && "code" in error && typeof error.code === "string" && "message" in error && typeof error.message === "string";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Internal Google One Tap Sign-In module.
|
|
37
|
+
*
|
|
38
|
+
* This module provides native Google Sign-In functionality using Google's
|
|
39
|
+
* Credential Manager API with full nonce support for replay attack protection.
|
|
40
|
+
*
|
|
41
|
+
* @internal This is an internal module. Use the `useSignInWithGoogle` hook instead.
|
|
42
|
+
* @platform Android, iOS
|
|
43
|
+
*/
|
|
44
|
+
const ClerkGoogleOneTapSignIn = {
|
|
45
|
+
/**
|
|
46
|
+
* Configure Google Sign-In. Must be called before any sign-in methods.
|
|
47
|
+
*
|
|
48
|
+
* @param params - Configuration parameters
|
|
49
|
+
* @param params.webClientId - The web client ID from Google Cloud Console (required)
|
|
50
|
+
* @param params.hostedDomain - Optional domain restriction
|
|
51
|
+
* @param params.autoSelectEnabled - Auto-select for single credential (default: false)
|
|
52
|
+
*/
|
|
53
|
+
configure(params) {
|
|
54
|
+
getNativeModule().configure(params);
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Attempt to sign in with saved credentials (One Tap).
|
|
58
|
+
*
|
|
59
|
+
* This method will show the One Tap UI if there are saved credentials,
|
|
60
|
+
* or return a "noSavedCredentialFound" response if there are none.
|
|
61
|
+
*
|
|
62
|
+
* @param params - Sign-in parameters
|
|
63
|
+
* @param params.nonce - Cryptographic nonce for replay protection
|
|
64
|
+
* @param params.filterByAuthorizedAccounts - Android only. Filter to previously authorized accounts.
|
|
65
|
+
* @param params.hint - iOS only. Hint for Google Sign-In.
|
|
66
|
+
*
|
|
67
|
+
* @returns Promise resolving to OneTapResponse
|
|
68
|
+
*/
|
|
69
|
+
async signIn(params) {
|
|
70
|
+
try {
|
|
71
|
+
return await getNativeModule().signIn(params ?? null);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (isErrorWithCode(error)) {
|
|
74
|
+
if (error.code === "SIGN_IN_CANCELLED") return {
|
|
75
|
+
type: "cancelled",
|
|
76
|
+
data: null
|
|
77
|
+
};
|
|
78
|
+
if (error.code === "NO_SAVED_CREDENTIAL_FOUND") return {
|
|
79
|
+
type: "noSavedCredentialFound",
|
|
80
|
+
data: null
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Create a new account (shows all Google accounts).
|
|
88
|
+
*
|
|
89
|
+
* This method shows the account picker with all available Google accounts,
|
|
90
|
+
* not just previously authorized ones.
|
|
91
|
+
*
|
|
92
|
+
* @param params - Create account parameters
|
|
93
|
+
* @param params.nonce - Cryptographic nonce for replay protection
|
|
94
|
+
*
|
|
95
|
+
* @returns Promise resolving to OneTapResponse
|
|
96
|
+
*/
|
|
97
|
+
async createAccount(params) {
|
|
98
|
+
try {
|
|
99
|
+
return await getNativeModule().createAccount(params ?? null);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
if (isErrorWithCode(error)) {
|
|
102
|
+
if (error.code === "SIGN_IN_CANCELLED") return {
|
|
103
|
+
type: "cancelled",
|
|
104
|
+
data: null
|
|
105
|
+
};
|
|
106
|
+
if (error.code === "NO_SAVED_CREDENTIAL_FOUND") return {
|
|
107
|
+
type: "noSavedCredentialFound",
|
|
108
|
+
data: null
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Present explicit sign-in UI (Google Sign-In button flow).
|
|
116
|
+
*
|
|
117
|
+
* This shows the full Google Sign-In UI, similar to clicking a
|
|
118
|
+
* "Sign in with Google" button.
|
|
119
|
+
*
|
|
120
|
+
* @param params - Explicit sign-in parameters
|
|
121
|
+
* @param params.nonce - Cryptographic nonce for replay protection
|
|
122
|
+
*
|
|
123
|
+
* @returns Promise resolving to OneTapResponse
|
|
124
|
+
*/
|
|
125
|
+
async presentExplicitSignIn(params) {
|
|
126
|
+
try {
|
|
127
|
+
return await getNativeModule().presentExplicitSignIn(params ?? null);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
if (isErrorWithCode(error)) {
|
|
130
|
+
if (error.code === "SIGN_IN_CANCELLED") return {
|
|
131
|
+
type: "cancelled",
|
|
132
|
+
data: null
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Sign out and clear credential state.
|
|
140
|
+
*
|
|
141
|
+
* This disables automatic sign-in until the user signs in again.
|
|
142
|
+
*/
|
|
143
|
+
async signOut() {
|
|
144
|
+
await getNativeModule().signOut();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
exports.ClerkGoogleOneTapSignIn = ClerkGoogleOneTapSignIn;
|
|
150
|
+
exports.isCancelledResponse = isCancelledResponse;
|
|
151
|
+
exports.isErrorWithCode = isErrorWithCode;
|
|
152
|
+
exports.isNoSavedCredentialFoundResponse = isNoSavedCredentialFoundResponse;
|
|
153
|
+
exports.isSuccessResponse = isSuccessResponse;
|
|
154
|
+
//# sourceMappingURL=ClerkGoogleOneTapSignIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClerkGoogleOneTapSignIn.js","names":["NativeClerkGoogleSignIn"],"sources":["../../src/google-one-tap/ClerkGoogleOneTapSignIn.ts"],"sourcesContent":["import NativeClerkGoogleSignIn from '../specs/NativeClerkGoogleSignIn';\nimport type {\n CancelledResponse,\n ConfigureParams,\n CreateAccountParams,\n ExplicitSignInParams,\n NoSavedCredentialFound,\n OneTapResponse,\n OneTapSuccessResponse,\n SignInParams,\n} from './types';\n\nfunction getNativeModule(): NonNullable<typeof NativeClerkGoogleSignIn> {\n if (!NativeClerkGoogleSignIn) {\n throw new Error(\n 'ClerkGoogleSignIn native module is not available. ' +\n 'Install @clerk/expo-google-signin (npx expo install @clerk/expo-google-signin), ' +\n 'add \"@clerk/expo-google-signin\" to the plugins array in your app config, then rebuild your native app.',\n );\n }\n return NativeClerkGoogleSignIn;\n}\n\n/**\n * Check if a response indicates the user cancelled the sign-in flow.\n */\nexport function isCancelledResponse(response: OneTapResponse): response is CancelledResponse {\n return response.type === 'cancelled';\n}\n\n/**\n * Check if a response indicates no saved credential was found.\n */\nexport function isNoSavedCredentialFoundResponse(response: OneTapResponse): response is NoSavedCredentialFound {\n return response.type === 'noSavedCredentialFound';\n}\n\n/**\n * Check if a response is a successful sign-in.\n */\nexport function isSuccessResponse(response: OneTapResponse): response is OneTapSuccessResponse {\n return response.type === 'success';\n}\n\n/**\n * Check if an error has code and message properties (Google Sign-In error).\n */\nexport function isErrorWithCode(error: unknown): error is { code: string; message: string } {\n return (\n error !== null &&\n typeof error === 'object' &&\n 'code' in error &&\n typeof (error as { code: unknown }).code === 'string' &&\n 'message' in error &&\n typeof (error as { message: unknown }).message === 'string'\n );\n}\n\n/**\n * Internal Google One Tap Sign-In module.\n *\n * This module provides native Google Sign-In functionality using Google's\n * Credential Manager API with full nonce support for replay attack protection.\n *\n * @internal This is an internal module. Use the `useSignInWithGoogle` hook instead.\n * @platform Android, iOS\n */\nexport const ClerkGoogleOneTapSignIn = {\n /**\n * Configure Google Sign-In. Must be called before any sign-in methods.\n *\n * @param params - Configuration parameters\n * @param params.webClientId - The web client ID from Google Cloud Console (required)\n * @param params.hostedDomain - Optional domain restriction\n * @param params.autoSelectEnabled - Auto-select for single credential (default: false)\n */\n configure(params: ConfigureParams): void {\n getNativeModule().configure(params as any);\n },\n\n /**\n * Attempt to sign in with saved credentials (One Tap).\n *\n * This method will show the One Tap UI if there are saved credentials,\n * or return a \"noSavedCredentialFound\" response if there are none.\n *\n * @param params - Sign-in parameters\n * @param params.nonce - Cryptographic nonce for replay protection\n * @param params.filterByAuthorizedAccounts - Android only. Filter to previously authorized accounts.\n * @param params.hint - iOS only. Hint for Google Sign-In.\n *\n * @returns Promise resolving to OneTapResponse\n */\n async signIn(params?: SignInParams): Promise<OneTapResponse> {\n try {\n return (await getNativeModule().signIn((params as any) ?? null)) as unknown as OneTapResponse;\n } catch (error) {\n if (isErrorWithCode(error)) {\n if (error.code === 'SIGN_IN_CANCELLED') {\n return { type: 'cancelled', data: null };\n }\n if (error.code === 'NO_SAVED_CREDENTIAL_FOUND') {\n return { type: 'noSavedCredentialFound', data: null };\n }\n }\n throw error;\n }\n },\n\n /**\n * Create a new account (shows all Google accounts).\n *\n * This method shows the account picker with all available Google accounts,\n * not just previously authorized ones.\n *\n * @param params - Create account parameters\n * @param params.nonce - Cryptographic nonce for replay protection\n *\n * @returns Promise resolving to OneTapResponse\n */\n async createAccount(params?: CreateAccountParams): Promise<OneTapResponse> {\n try {\n return (await getNativeModule().createAccount((params as any) ?? null)) as unknown as OneTapResponse;\n } catch (error) {\n if (isErrorWithCode(error)) {\n if (error.code === 'SIGN_IN_CANCELLED') {\n return { type: 'cancelled', data: null };\n }\n if (error.code === 'NO_SAVED_CREDENTIAL_FOUND') {\n return { type: 'noSavedCredentialFound', data: null };\n }\n }\n throw error;\n }\n },\n\n /**\n * Present explicit sign-in UI (Google Sign-In button flow).\n *\n * This shows the full Google Sign-In UI, similar to clicking a\n * \"Sign in with Google\" button.\n *\n * @param params - Explicit sign-in parameters\n * @param params.nonce - Cryptographic nonce for replay protection\n *\n * @returns Promise resolving to OneTapResponse\n */\n async presentExplicitSignIn(params?: ExplicitSignInParams): Promise<OneTapResponse> {\n try {\n return (await getNativeModule().presentExplicitSignIn((params as any) ?? null)) as unknown as OneTapResponse;\n } catch (error) {\n if (isErrorWithCode(error)) {\n if (error.code === 'SIGN_IN_CANCELLED') {\n return { type: 'cancelled', data: null };\n }\n }\n throw error;\n }\n },\n\n /**\n * Sign out and clear credential state.\n *\n * This disables automatic sign-in until the user signs in again.\n */\n async signOut(): Promise<void> {\n await getNativeModule().signOut();\n },\n};\n\nexport type {\n ConfigureParams,\n SignInParams,\n CreateAccountParams,\n ExplicitSignInParams,\n OneTapResponse,\n OneTapSuccessResponse,\n CancelledResponse,\n NoSavedCredentialFound,\n GoogleUser,\n} from './types';\n"],"mappings":";;;;;;AAYA,SAAS,kBAA+D;CACtE,IAAI,CAACA,2CACH,MAAM,IAAI,MACR,4OAGF;CAEF,OAAOA;AACT;;;;AAKA,SAAgB,oBAAoB,UAAyD;CAC3F,OAAO,SAAS,SAAS;AAC3B;;;;AAKA,SAAgB,iCAAiC,UAA8D;CAC7G,OAAO,SAAS,SAAS;AAC3B;;;;AAKA,SAAgB,kBAAkB,UAA6D;CAC7F,OAAO,SAAS,SAAS;AAC3B;;;;AAKA,SAAgB,gBAAgB,OAA4D;CAC1F,OACE,UAAU,QACV,OAAO,UAAU,YACjB,UAAU,SACV,OAAQ,MAA4B,SAAS,YAC7C,aAAa,SACb,OAAQ,MAA+B,YAAY;AAEvD;;;;;;;;;;AAWA,MAAa,0BAA0B;;;;;;;;;CASrC,UAAU,QAA+B;EACvC,gBAAgB,CAAC,CAAC,UAAU,MAAa;CAC3C;;;;;;;;;;;;;;CAeA,MAAM,OAAO,QAAgD;EAC3D,IAAI;GACF,OAAQ,MAAM,gBAAgB,CAAC,CAAC,OAAQ,UAAkB,IAAI;EAChE,SAAS,OAAO;GACd,IAAI,gBAAgB,KAAK,GAAG;IAC1B,IAAI,MAAM,SAAS,qBACjB,OAAO;KAAE,MAAM;KAAa,MAAM;IAAK;IAEzC,IAAI,MAAM,SAAS,6BACjB,OAAO;KAAE,MAAM;KAA0B,MAAM;IAAK;GAExD;GACA,MAAM;EACR;CACF;;;;;;;;;;;;CAaA,MAAM,cAAc,QAAuD;EACzE,IAAI;GACF,OAAQ,MAAM,gBAAgB,CAAC,CAAC,cAAe,UAAkB,IAAI;EACvE,SAAS,OAAO;GACd,IAAI,gBAAgB,KAAK,GAAG;IAC1B,IAAI,MAAM,SAAS,qBACjB,OAAO;KAAE,MAAM;KAAa,MAAM;IAAK;IAEzC,IAAI,MAAM,SAAS,6BACjB,OAAO;KAAE,MAAM;KAA0B,MAAM;IAAK;GAExD;GACA,MAAM;EACR;CACF;;;;;;;;;;;;CAaA,MAAM,sBAAsB,QAAwD;EAClF,IAAI;GACF,OAAQ,MAAM,gBAAgB,CAAC,CAAC,sBAAuB,UAAkB,IAAI;EAC/E,SAAS,OAAO;GACd,IAAI,gBAAgB,KAAK,GACvB;QAAI,MAAM,SAAS,qBACjB,OAAO;KAAE,MAAM;KAAa,MAAM;IAAK;GACzC;GAEF,MAAM;EACR;CACF;;;;;;CAOA,MAAM,UAAyB;EAC7B,MAAM,gBAAgB,CAAC,CAAC,QAAQ;CAClC;AACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ClerkGoogleOneTapSignIn, isCancelledResponse, isNoSavedCredentialFoundResponse, isSuccessResponse, isErrorWithCode, } from './ClerkGoogleOneTapSignIn';
|
|
2
|
+
export type { ConfigureParams, SignInParams, CreateAccountParams, ExplicitSignInParams, OneTapResponse, OneTapSuccessResponse, CancelledResponse, NoSavedCredentialFound, GoogleUser, GoogleSignInError, GoogleSignInErrorCode, } from './types';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/google-one-tap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,gCAAgC,EAChC,iBAAiB,EACjB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let src_google_one_tap_ClerkGoogleOneTapSignIn = require("./ClerkGoogleOneTapSignIn");
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, 'ClerkGoogleOneTapSignIn', {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () {
|
|
7
|
+
return src_google_one_tap_ClerkGoogleOneTapSignIn.ClerkGoogleOneTapSignIn;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, 'isCancelledResponse', {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return src_google_one_tap_ClerkGoogleOneTapSignIn.isCancelledResponse;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, 'isErrorWithCode', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return src_google_one_tap_ClerkGoogleOneTapSignIn.isErrorWithCode;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, 'isNoSavedCredentialFoundResponse', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return src_google_one_tap_ClerkGoogleOneTapSignIn.isNoSavedCredentialFoundResponse;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'isSuccessResponse', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return src_google_one_tap_ClerkGoogleOneTapSignIn.isSuccessResponse;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration parameters for Google One Tap Sign-In.
|
|
3
|
+
*/
|
|
4
|
+
export type ConfigureParams = {
|
|
5
|
+
/**
|
|
6
|
+
* The web client ID from Google Cloud Console.
|
|
7
|
+
* This is required for Google Sign-In to work.
|
|
8
|
+
* On iOS, this is used as the serverClientID for token audience.
|
|
9
|
+
*/
|
|
10
|
+
webClientId: string;
|
|
11
|
+
/**
|
|
12
|
+
* The iOS client ID from Google Cloud Console.
|
|
13
|
+
* This is only used on iOS for the OAuth flow.
|
|
14
|
+
* If not provided, webClientId will be used.
|
|
15
|
+
* @platform iOS
|
|
16
|
+
*/
|
|
17
|
+
iosClientId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The hosted domain to restrict sign-in to a specific domain.
|
|
20
|
+
*/
|
|
21
|
+
hostedDomain?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to enable auto-select for returning users.
|
|
24
|
+
* When true, if only one credential is available, it will be automatically selected.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
autoSelectEnabled?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Parameters for the signIn method.
|
|
31
|
+
*/
|
|
32
|
+
export type SignInParams = {
|
|
33
|
+
/**
|
|
34
|
+
* A cryptographically random string used to mitigate replay attacks.
|
|
35
|
+
* The nonce will be included in the ID token.
|
|
36
|
+
*/
|
|
37
|
+
nonce?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Android only. Whether to filter credentials to only show accounts that have
|
|
40
|
+
* previously authorized this app.
|
|
41
|
+
*
|
|
42
|
+
* No-op on iOS.
|
|
43
|
+
*
|
|
44
|
+
* @platform Android
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
filterByAuthorizedAccounts?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* iOS only. Hint passed to Google Sign-In, such as a user ID or email
|
|
50
|
+
* address.
|
|
51
|
+
*
|
|
52
|
+
* This may prefill or prioritize an account when possible, but does not
|
|
53
|
+
* restrict the account picker.
|
|
54
|
+
*
|
|
55
|
+
* No-op on Android.
|
|
56
|
+
*
|
|
57
|
+
* @platform iOS
|
|
58
|
+
*/
|
|
59
|
+
hint?: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Parameters for the createAccount method.
|
|
63
|
+
*/
|
|
64
|
+
export type CreateAccountParams = {
|
|
65
|
+
/**
|
|
66
|
+
* A cryptographically random string used to mitigate replay attacks.
|
|
67
|
+
* The nonce will be included in the ID token.
|
|
68
|
+
*/
|
|
69
|
+
nonce?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Parameters for the presentExplicitSignIn method.
|
|
73
|
+
*/
|
|
74
|
+
export type ExplicitSignInParams = {
|
|
75
|
+
/**
|
|
76
|
+
* A cryptographically random string used to mitigate replay attacks.
|
|
77
|
+
* The nonce will be included in the ID token.
|
|
78
|
+
*/
|
|
79
|
+
nonce?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* User information returned from Google Sign-In.
|
|
83
|
+
*/
|
|
84
|
+
export type GoogleUser = {
|
|
85
|
+
/**
|
|
86
|
+
* The user's unique Google identifier (OIDC "sub" claim).
|
|
87
|
+
* This is distinct from the user's email address.
|
|
88
|
+
*/
|
|
89
|
+
id: string;
|
|
90
|
+
/**
|
|
91
|
+
* The user's email address.
|
|
92
|
+
*/
|
|
93
|
+
email: string;
|
|
94
|
+
/**
|
|
95
|
+
* The user's full display name.
|
|
96
|
+
*/
|
|
97
|
+
name: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* The user's given (first) name.
|
|
100
|
+
*/
|
|
101
|
+
givenName: string | null;
|
|
102
|
+
/**
|
|
103
|
+
* The user's family (last) name.
|
|
104
|
+
*/
|
|
105
|
+
familyName: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* URL to the user's profile picture.
|
|
108
|
+
*/
|
|
109
|
+
photo: string | null;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Successful sign-in response.
|
|
113
|
+
*/
|
|
114
|
+
export type OneTapSuccessResponse = {
|
|
115
|
+
type: 'success';
|
|
116
|
+
data: {
|
|
117
|
+
/**
|
|
118
|
+
* The Google ID token containing user information and nonce.
|
|
119
|
+
*/
|
|
120
|
+
idToken: string;
|
|
121
|
+
/**
|
|
122
|
+
* The user's information.
|
|
123
|
+
*/
|
|
124
|
+
user: GoogleUser;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Response when the user cancels the sign-in flow.
|
|
129
|
+
*/
|
|
130
|
+
export type CancelledResponse = {
|
|
131
|
+
type: 'cancelled';
|
|
132
|
+
data: null;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Response when no saved credential is found.
|
|
136
|
+
*/
|
|
137
|
+
export type NoSavedCredentialFound = {
|
|
138
|
+
type: 'noSavedCredentialFound';
|
|
139
|
+
data: null;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Union type for all possible One Tap responses.
|
|
143
|
+
*/
|
|
144
|
+
export type OneTapResponse = OneTapSuccessResponse | CancelledResponse | NoSavedCredentialFound;
|
|
145
|
+
/**
|
|
146
|
+
* Error codes that can be thrown by the Google Sign-In module.
|
|
147
|
+
*
|
|
148
|
+
* - `SIGN_IN_CANCELLED`: User cancelled the sign-in flow
|
|
149
|
+
* - `NO_SAVED_CREDENTIAL_FOUND`: No saved credentials available for One Tap
|
|
150
|
+
* - `NOT_CONFIGURED`: Module not configured before use
|
|
151
|
+
* - `GOOGLE_SIGN_IN_ERROR`: Generic Google Sign-In error
|
|
152
|
+
* - `E_ACTIVITY_UNAVAILABLE`: Android activity unavailable (GoogleSignInActivityUnavailableException)
|
|
153
|
+
*/
|
|
154
|
+
export type GoogleSignInErrorCode = 'SIGN_IN_CANCELLED' | 'NO_SAVED_CREDENTIAL_FOUND' | 'NOT_CONFIGURED' | 'GOOGLE_SIGN_IN_ERROR' | 'E_ACTIVITY_UNAVAILABLE';
|
|
155
|
+
/**
|
|
156
|
+
* Error thrown by the Google Sign-In module.
|
|
157
|
+
*/
|
|
158
|
+
export interface GoogleSignInError extends Error {
|
|
159
|
+
code: GoogleSignInErrorCode;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/google-one-tap/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;OAQG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACJ;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC;AAEhG;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAC7B,mBAAmB,GACnB,2BAA2B,GAC3B,gBAAgB,GAChB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,KAAK;IAC9C,IAAI,EAAE,qBAAqB,CAAC;CAC7B"}
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type { StartGoogleAuthenticationFlowParams, StartGoogleAuthenticationFlowReturnType, } from './useSignInWithGoogle.types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for native Google Authentication on Android using Clerk's built-in Google One Tap module.
|
|
4
|
+
*
|
|
5
|
+
* This hook provides a simplified way to authenticate users with their Google account
|
|
6
|
+
* using the native Android Google Sign-In UI with Credential Manager. The authentication
|
|
7
|
+
* flow automatically handles the ID token exchange with Clerk's backend and manages
|
|
8
|
+
* the transfer flow between sign-in and sign-up.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Native Google One Tap UI
|
|
12
|
+
* - Built-in nonce support for replay attack protection
|
|
13
|
+
*
|
|
14
|
+
* Requires the `@clerk/expo-google-signin` package to be installed and its Expo
|
|
15
|
+
* config plugin added, which provide the native module.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { useSignInWithGoogle } from '@clerk/expo/google';
|
|
20
|
+
* import { Button } from 'react-native';
|
|
21
|
+
*
|
|
22
|
+
* function GoogleSignInButton() {
|
|
23
|
+
* const { startGoogleAuthenticationFlow } = useSignInWithGoogle();
|
|
24
|
+
*
|
|
25
|
+
* const onPress = async () => {
|
|
26
|
+
* try {
|
|
27
|
+
* const { createdSessionId, setActive } = await startGoogleAuthenticationFlow();
|
|
28
|
+
*
|
|
29
|
+
* if (createdSessionId && setActive) {
|
|
30
|
+
* await setActive({ session: createdSessionId });
|
|
31
|
+
* }
|
|
32
|
+
* } catch (err) {
|
|
33
|
+
* console.error('Google Authentication error:', err);
|
|
34
|
+
* }
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* return <Button title="Sign in with Google" onPress={onPress} />;
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @platform Android - This is the Android-specific implementation using Credential Manager
|
|
42
|
+
*
|
|
43
|
+
* @returns An object containing the `startGoogleAuthenticationFlow` function
|
|
44
|
+
*/
|
|
45
|
+
export declare const useSignInWithGoogle: () => {
|
|
46
|
+
startGoogleAuthenticationFlow: (startGoogleAuthenticationFlowParams?: import("./useSignInWithGoogle.types").StartGoogleAuthenticationFlowParams) => Promise<import("./useSignInWithGoogle.types").StartGoogleAuthenticationFlowReturnType>;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=useSignInWithGoogle.android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInWithGoogle.android.d.ts","sourceRoot":"","sources":["../../src/hooks/useSignInWithGoogle.android.ts"],"names":[],"mappings":"AACA,YAAY,EACV,mCAAmC,EACnC,uCAAuC,GACxC,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,mBAAmB;;CAA4D,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let src_hooks_useSignInWithGoogle_shared = require("./useSignInWithGoogle.shared");
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/useSignInWithGoogle.android.ts
|
|
5
|
+
/**
|
|
6
|
+
* Hook for native Google Authentication on Android using Clerk's built-in Google One Tap module.
|
|
7
|
+
*
|
|
8
|
+
* This hook provides a simplified way to authenticate users with their Google account
|
|
9
|
+
* using the native Android Google Sign-In UI with Credential Manager. The authentication
|
|
10
|
+
* flow automatically handles the ID token exchange with Clerk's backend and manages
|
|
11
|
+
* the transfer flow between sign-in and sign-up.
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - Native Google One Tap UI
|
|
15
|
+
* - Built-in nonce support for replay attack protection
|
|
16
|
+
*
|
|
17
|
+
* Requires the `@clerk/expo-google-signin` package to be installed and its Expo
|
|
18
|
+
* config plugin added, which provide the native module.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { useSignInWithGoogle } from '@clerk/expo/google';
|
|
23
|
+
* import { Button } from 'react-native';
|
|
24
|
+
*
|
|
25
|
+
* function GoogleSignInButton() {
|
|
26
|
+
* const { startGoogleAuthenticationFlow } = useSignInWithGoogle();
|
|
27
|
+
*
|
|
28
|
+
* const onPress = async () => {
|
|
29
|
+
* try {
|
|
30
|
+
* const { createdSessionId, setActive } = await startGoogleAuthenticationFlow();
|
|
31
|
+
*
|
|
32
|
+
* if (createdSessionId && setActive) {
|
|
33
|
+
* await setActive({ session: createdSessionId });
|
|
34
|
+
* }
|
|
35
|
+
* } catch (err) {
|
|
36
|
+
* console.error('Google Authentication error:', err);
|
|
37
|
+
* }
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* return <Button title="Sign in with Google" onPress={onPress} />;
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @platform Android - This is the Android-specific implementation using Credential Manager
|
|
45
|
+
*
|
|
46
|
+
* @returns An object containing the `startGoogleAuthenticationFlow` function
|
|
47
|
+
*/
|
|
48
|
+
const useSignInWithGoogle = (0, src_hooks_useSignInWithGoogle_shared.createUseSignInWithGoogle)({ requiresIosClientId: false });
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.useSignInWithGoogle = useSignInWithGoogle;
|
|
52
|
+
//# sourceMappingURL=useSignInWithGoogle.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInWithGoogle.android.js","names":[],"sources":["../../src/hooks/useSignInWithGoogle.android.ts"],"sourcesContent":["import { createUseSignInWithGoogle } from './useSignInWithGoogle.shared';\nexport type {\n StartGoogleAuthenticationFlowParams,\n StartGoogleAuthenticationFlowReturnType,\n} from './useSignInWithGoogle.types';\n\n/**\n * Hook for native Google Authentication on Android using Clerk's built-in Google One Tap module.\n *\n * This hook provides a simplified way to authenticate users with their Google account\n * using the native Android Google Sign-In UI with Credential Manager. The authentication\n * flow automatically handles the ID token exchange with Clerk's backend and manages\n * the transfer flow between sign-in and sign-up.\n *\n * Features:\n * - Native Google One Tap UI\n * - Built-in nonce support for replay attack protection\n *\n * Requires the `@clerk/expo-google-signin` package to be installed and its Expo\n * config plugin added, which provide the native module.\n *\n * @example\n * ```tsx\n * import { useSignInWithGoogle } from '@clerk/expo/google';\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 Android - This is the Android-specific implementation using Credential Manager\n *\n * @returns An object containing the `startGoogleAuthenticationFlow` function\n */\nexport const useSignInWithGoogle = createUseSignInWithGoogle({ requiresIosClientId: false });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,0FAAgD,EAAE,qBAAqB,MAAM,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types';
|
|
2
|
+
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
|
+
/**
|
|
13
|
+
* Stub for Google Authentication hook on unsupported platforms.
|
|
14
|
+
*
|
|
15
|
+
* Native Google Authentication is only available on iOS and Android.
|
|
16
|
+
* For web platforms, use the OAuth-based Google Sign-In flow instead via useSSO.
|
|
17
|
+
*
|
|
18
|
+
* On iOS and Android, native Google Sign-In requires the `@clerk/expo-google-signin`
|
|
19
|
+
* package to be installed and its Expo config plugin added.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { useSSO } from '@clerk/expo';
|
|
24
|
+
* import { Button } from 'react-native';
|
|
25
|
+
*
|
|
26
|
+
* function GoogleSignInButton() {
|
|
27
|
+
* const { startSSOFlow } = useSSO();
|
|
28
|
+
*
|
|
29
|
+
* const onPress = async () => {
|
|
30
|
+
* try {
|
|
31
|
+
* const { createdSessionId, setActive } = await startSSOFlow({
|
|
32
|
+
* strategy: 'oauth_google'
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* if (createdSessionId && setActive) {
|
|
36
|
+
* await setActive({ session: createdSessionId });
|
|
37
|
+
* }
|
|
38
|
+
* } catch (err) {
|
|
39
|
+
* console.error('Google Authentication error:', err);
|
|
40
|
+
* }
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* return <Button title="Sign in with Google" onPress={onPress} />;
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @platform iOS, Android - This hook only works on iOS and Android. On other platforms, it will throw an error.
|
|
48
|
+
*
|
|
49
|
+
* @returns An object containing the `startGoogleAuthenticationFlow` function that throws an error
|
|
50
|
+
*/
|
|
51
|
+
export declare function useSignInWithGoogle(): {
|
|
52
|
+
startGoogleAuthenticationFlow: (startGoogleAuthenticationFlowParams?: StartGoogleAuthenticationFlowParams) => Promise<StartGoogleAuthenticationFlowReturnType>;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=useSignInWithGoogle.d.ts.map
|