@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.
- package/dist/errorThrower.d.ts +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/provider/ClerkProvider.js +1 -1
- package/dist/utils/errors.d.ts +1 -1
- package/package.json +12 -33
- package/android/build.gradle +0 -64
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/expo/modules/clerk/googlesignin/ClerkGoogleSignInModule.kt +0 -264
- package/app.plugin.js +0 -1
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.d.ts +0 -104
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.d.ts.map +0 -1
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.js +0 -153
- package/dist/google-one-tap/ClerkGoogleOneTapSignIn.js.map +0 -1
- package/dist/google-one-tap/index.d.ts +0 -3
- package/dist/google-one-tap/index.d.ts.map +0 -1
- package/dist/google-one-tap/index.js +0 -37
- package/dist/google-one-tap/index.js.map +0 -1
- package/dist/google-one-tap/types.d.ts +0 -139
- package/dist/google-one-tap/types.d.ts.map +0 -1
- package/dist/google-one-tap/types.js +0 -17
- package/dist/google-one-tap/types.js.map +0 -1
- package/dist/hooks/useSignInWithGoogle.android.d.ts +0 -47
- package/dist/hooks/useSignInWithGoogle.android.d.ts.map +0 -1
- package/dist/hooks/useSignInWithGoogle.android.js +0 -65
- package/dist/hooks/useSignInWithGoogle.android.js.map +0 -1
- package/dist/hooks/useSignInWithGoogle.d.ts +0 -52
- package/dist/hooks/useSignInWithGoogle.d.ts.map +0 -1
- package/dist/hooks/useSignInWithGoogle.ios.d.ts +0 -47
- package/dist/hooks/useSignInWithGoogle.ios.d.ts.map +0 -1
- package/dist/hooks/useSignInWithGoogle.ios.js +0 -70
- package/dist/hooks/useSignInWithGoogle.ios.js.map +0 -1
- package/dist/hooks/useSignInWithGoogle.js +0 -39
- package/dist/hooks/useSignInWithGoogle.js.map +0 -1
- package/dist/hooks/useSignInWithGoogle.shared.d.ts +0 -17
- package/dist/hooks/useSignInWithGoogle.shared.d.ts.map +0 -1
- package/dist/hooks/useSignInWithGoogle.shared.js +0 -112
- package/dist/hooks/useSignInWithGoogle.shared.js.map +0 -1
- package/dist/hooks/useSignInWithGoogle.types.d.ts +0 -12
- package/dist/hooks/useSignInWithGoogle.types.d.ts.map +0 -1
- package/dist/hooks/useSignInWithGoogle.types.js +0 -17
- package/dist/hooks/useSignInWithGoogle.types.js.map +0 -1
- package/expo-module.config.json +0 -9
- package/ios/ClerkGoogleSignIn.podspec +0 -22
- package/ios/ClerkGoogleSignInModule.swift +0 -229
- package/plugin/build/withClerkExpo.d.ts +0 -3
- package/plugin/build/withClerkExpo.js +0 -36
- package/plugin/src/withClerkExpo.ts +0 -45
- package/plugin/tsconfig.json +0 -15
package/dist/errorThrower.d.ts
CHANGED
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { useClerk, useEmailLink, useOrganization, useOrganizationList, useSession, useSessionList, useSignIn, useSignUp, useUser, useReverification, } from '@clerk/react';
|
|
2
2
|
export * from './useSignInWithApple';
|
|
3
|
-
export * from './useSignInWithGoogle';
|
|
4
3
|
export * from './useSSO';
|
|
5
4
|
export * from './useOAuth';
|
|
6
5
|
export * from './useAuth';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,EACP,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,cAAc,sBAAsB,CAAC;AACrC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,EACP,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -33,7 +33,6 @@ __export(hooks_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(hooks_exports);
|
|
34
34
|
var import_react = require("@clerk/react");
|
|
35
35
|
__reExport(hooks_exports, require("./useSignInWithApple"), module.exports);
|
|
36
|
-
__reExport(hooks_exports, require("./useSignInWithGoogle"), module.exports);
|
|
37
36
|
__reExport(hooks_exports, require("./useSSO"), module.exports);
|
|
38
37
|
__reExport(hooks_exports, require("./useOAuth"), module.exports);
|
|
39
38
|
__reExport(hooks_exports, require("./useAuth"), module.exports);
|
|
@@ -50,7 +49,6 @@ __reExport(hooks_exports, require("./useAuth"), module.exports);
|
|
|
50
49
|
useSignUp,
|
|
51
50
|
useUser,
|
|
52
51
|
...require("./useSignInWithApple"),
|
|
53
|
-
...require("./useSignInWithGoogle"),
|
|
54
52
|
...require("./useSSO"),
|
|
55
53
|
...require("./useOAuth"),
|
|
56
54
|
...require("./useAuth")
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/index.ts"],"sourcesContent":["export {\n useClerk,\n useEmailLink,\n useOrganization,\n useOrganizationList,\n useSession,\n useSessionList,\n useSignIn,\n useSignUp,\n useUser,\n useReverification,\n} from '@clerk/react';\n\nexport * from './useSignInWithApple';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"sourcesContent":["export {\n useClerk,\n useEmailLink,\n useOrganization,\n useOrganizationList,\n useSession,\n useSessionList,\n useSignIn,\n useSignUp,\n useUser,\n useReverification,\n} from '@clerk/react';\n\nexport * from './useSignInWithApple';\nexport * from './useSSO';\nexport * from './useOAuth';\nexport * from './useAuth';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAWO;AAEP,0BAAc,iCAbd;AAcA,0BAAc,qBAdd;AAeA,0BAAc,uBAfd;AAgBA,0BAAc,sBAhBd;","names":[]}
|
|
@@ -39,7 +39,7 @@ var import_runtime = require("../utils/runtime");
|
|
|
39
39
|
var import_singleton = require("./singleton");
|
|
40
40
|
const SDK_METADATA = {
|
|
41
41
|
name: "@clerk/expo",
|
|
42
|
-
version: "3.0.0-snapshot.
|
|
42
|
+
version: "3.0.0-snapshot.v20251217162523"
|
|
43
43
|
};
|
|
44
44
|
function ClerkProvider(props) {
|
|
45
45
|
const {
|
package/dist/utils/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const errorThrower: import("@clerk/shared/error-
|
|
1
|
+
export declare const errorThrower: import("@clerk/shared/error-D_08BTAz").y;
|
|
2
2
|
//# sourceMappingURL=errors.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerk/expo",
|
|
3
|
-
"version": "3.0.0-snapshot.
|
|
3
|
+
"version": "3.0.0-snapshot.v20251217162523",
|
|
4
4
|
"description": "Clerk React Native/Expo library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -59,61 +59,44 @@
|
|
|
59
59
|
"./legacy": {
|
|
60
60
|
"types": "./dist/legacy.d.ts",
|
|
61
61
|
"default": "./dist/legacy.js"
|
|
62
|
-
}
|
|
63
|
-
"./app.plugin.js": "./app.plugin.js",
|
|
64
|
-
"./package.json": "./package.json"
|
|
62
|
+
}
|
|
65
63
|
},
|
|
66
64
|
"main": "./dist/index.js",
|
|
67
65
|
"source": "./src/index.ts",
|
|
68
66
|
"types": "./dist/index.d.ts",
|
|
69
67
|
"files": [
|
|
70
|
-
"dist"
|
|
71
|
-
"android",
|
|
72
|
-
"ios",
|
|
73
|
-
"expo-module.config.json",
|
|
74
|
-
"app.plugin.js",
|
|
75
|
-
"plugin",
|
|
76
|
-
"web",
|
|
77
|
-
"local-credentials",
|
|
78
|
-
"passkeys",
|
|
79
|
-
"secure-store",
|
|
80
|
-
"resource-cache",
|
|
81
|
-
"token-cache"
|
|
68
|
+
"dist"
|
|
82
69
|
],
|
|
83
70
|
"dependencies": {
|
|
84
71
|
"base-64": "^1.0.0",
|
|
85
72
|
"react-native-url-polyfill": "2.0.0",
|
|
86
73
|
"tslib": "2.8.1",
|
|
87
|
-
"@clerk/clerk-js": "
|
|
88
|
-
"@clerk/react": "6.0.0-snapshot.
|
|
89
|
-
"@clerk/shared": "4.0.0-snapshot.
|
|
74
|
+
"@clerk/clerk-js": "6.0.0-snapshot.v20251217162523",
|
|
75
|
+
"@clerk/react": "6.0.0-snapshot.v20251217162523",
|
|
76
|
+
"@clerk/shared": "4.0.0-snapshot.v20251217162523"
|
|
90
77
|
},
|
|
91
78
|
"devDependencies": {
|
|
92
|
-
"@expo/config-plugins": "^54.0.4",
|
|
93
79
|
"@types/base-64": "^1.0.2",
|
|
94
80
|
"expo-apple-authentication": "^7.2.4",
|
|
95
81
|
"expo-auth-session": "^5.4.0",
|
|
96
|
-
"expo-constants": "^18.0.0",
|
|
97
82
|
"expo-crypto": "^15.0.7",
|
|
98
83
|
"expo-local-authentication": "^13.8.0",
|
|
99
|
-
"expo-modules-core": "^3.0.0",
|
|
100
84
|
"expo-secure-store": "^12.8.1",
|
|
101
85
|
"expo-web-browser": "^12.8.2",
|
|
102
86
|
"react-native": "^0.81.4",
|
|
103
|
-
"@clerk/expo-passkeys": "1.0.0-snapshot.
|
|
87
|
+
"@clerk/expo-passkeys": "1.0.0-snapshot.v20251217162523"
|
|
104
88
|
},
|
|
105
89
|
"peerDependencies": {
|
|
106
|
-
"@clerk/expo-passkeys": "1.0.0-snapshot.
|
|
90
|
+
"@clerk/expo-passkeys": "1.0.0-snapshot.v20251217162523",
|
|
91
|
+
"expo": ">=53 <55",
|
|
107
92
|
"expo-apple-authentication": ">=7.0.0",
|
|
108
93
|
"expo-auth-session": ">=5",
|
|
109
|
-
"expo-constants": ">=12",
|
|
110
94
|
"expo-crypto": ">=12",
|
|
111
95
|
"expo-local-authentication": ">=13.5.0",
|
|
112
|
-
"expo-modules-core": ">=3.0.0",
|
|
113
96
|
"expo-secure-store": ">=12.4.0",
|
|
114
97
|
"expo-web-browser": ">=12.5.0",
|
|
115
|
-
"react": "^18.0.0 || ^19.0.
|
|
116
|
-
"react-dom": "^18.0.0 || ^19.0.
|
|
98
|
+
"react": "^18.0.0 || ^19.0.3 || ^19.1.4 || ^19.2.3 || ^19.3.0-0",
|
|
99
|
+
"react-dom": "^18.0.0 || ^19.0.3 || ^19.1.4 || ^19.2.3 || ^19.3.0-0",
|
|
117
100
|
"react-native": ">=0.73"
|
|
118
101
|
},
|
|
119
102
|
"peerDependenciesMeta": {
|
|
@@ -123,9 +106,6 @@
|
|
|
123
106
|
"expo-apple-authentication": {
|
|
124
107
|
"optional": true
|
|
125
108
|
},
|
|
126
|
-
"expo-constants": {
|
|
127
|
-
"optional": true
|
|
128
|
-
},
|
|
129
109
|
"expo-crypto": {
|
|
130
110
|
"optional": true
|
|
131
111
|
},
|
|
@@ -143,9 +123,8 @@
|
|
|
143
123
|
"access": "public"
|
|
144
124
|
},
|
|
145
125
|
"scripts": {
|
|
146
|
-
"build": "tsup
|
|
126
|
+
"build": "tsup",
|
|
147
127
|
"build:declarations": "tsc -p tsconfig.declarations.json",
|
|
148
|
-
"build:plugin": "tsc -p plugin/tsconfig.json",
|
|
149
128
|
"clean": "rimraf ./dist",
|
|
150
129
|
"dev": "tsup --watch",
|
|
151
130
|
"dev:publish": "pnpm dev -- --env.publish",
|
package/android/build.gradle
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
|
|
4
|
-
group = 'com.clerk.expo'
|
|
5
|
-
version = '1.0.0'
|
|
6
|
-
|
|
7
|
-
// Dependency versions - centralized for easier updates
|
|
8
|
-
// See: https://docs.gradle.org/current/userguide/version_catalogs.html for app-level version catalogs
|
|
9
|
-
ext {
|
|
10
|
-
credentialsVersion = "1.3.0"
|
|
11
|
-
googleIdVersion = "1.1.1"
|
|
12
|
-
kotlinxCoroutinesVersion = "1.7.3"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
def safeExtGet(prop, fallback) {
|
|
16
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
android {
|
|
20
|
-
namespace "expo.modules.clerk.googlesignin"
|
|
21
|
-
|
|
22
|
-
compileSdk safeExtGet("compileSdkVersion", 36)
|
|
23
|
-
|
|
24
|
-
defaultConfig {
|
|
25
|
-
minSdk safeExtGet("minSdkVersion", 24)
|
|
26
|
-
targetSdk safeExtGet("targetSdkVersion", 36)
|
|
27
|
-
versionCode 1
|
|
28
|
-
versionName "1.0.0"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
buildTypes {
|
|
32
|
-
release {
|
|
33
|
-
minifyEnabled false
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
compileOptions {
|
|
38
|
-
sourceCompatibility JavaVersion.VERSION_17
|
|
39
|
-
targetCompatibility JavaVersion.VERSION_17
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
kotlinOptions {
|
|
43
|
-
jvmTarget = "17"
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
sourceSets {
|
|
47
|
-
main {
|
|
48
|
-
java.srcDirs = ['src/main/java']
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
dependencies {
|
|
54
|
-
// Expo modules core
|
|
55
|
-
implementation project(':expo-modules-core')
|
|
56
|
-
|
|
57
|
-
// Credential Manager for Google Sign-In with nonce support
|
|
58
|
-
implementation "androidx.credentials:credentials:$credentialsVersion"
|
|
59
|
-
implementation "androidx.credentials:credentials-play-services-auth:$credentialsVersion"
|
|
60
|
-
implementation "com.google.android.libraries.identity.googleid:googleid:$googleIdVersion"
|
|
61
|
-
|
|
62
|
-
// Coroutines for async operations
|
|
63
|
-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinxCoroutinesVersion"
|
|
64
|
-
}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
package expo.modules.clerk.googlesignin
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import androidx.credentials.ClearCredentialStateRequest
|
|
5
|
-
import androidx.credentials.CredentialManager
|
|
6
|
-
import androidx.credentials.CustomCredential
|
|
7
|
-
import androidx.credentials.GetCredentialRequest
|
|
8
|
-
import androidx.credentials.GetCredentialResponse
|
|
9
|
-
import androidx.credentials.exceptions.GetCredentialCancellationException
|
|
10
|
-
import androidx.credentials.exceptions.GetCredentialException
|
|
11
|
-
import androidx.credentials.exceptions.NoCredentialException
|
|
12
|
-
import com.google.android.libraries.identity.googleid.GetGoogleIdOption
|
|
13
|
-
import com.google.android.libraries.identity.googleid.GetSignInWithGoogleOption
|
|
14
|
-
import com.google.android.libraries.identity.googleid.GoogleIdTokenCredential
|
|
15
|
-
import com.google.android.libraries.identity.googleid.GoogleIdTokenParsingException
|
|
16
|
-
import expo.modules.kotlin.Promise
|
|
17
|
-
import expo.modules.kotlin.exception.CodedException
|
|
18
|
-
import expo.modules.kotlin.modules.Module
|
|
19
|
-
import expo.modules.kotlin.modules.ModuleDefinition
|
|
20
|
-
import expo.modules.kotlin.records.Field
|
|
21
|
-
import expo.modules.kotlin.records.Record
|
|
22
|
-
import kotlinx.coroutines.CoroutineScope
|
|
23
|
-
import kotlinx.coroutines.Dispatchers
|
|
24
|
-
import kotlinx.coroutines.launch
|
|
25
|
-
|
|
26
|
-
// Configuration parameters
|
|
27
|
-
class ConfigureParams : Record {
|
|
28
|
-
@Field
|
|
29
|
-
val webClientId: String = ""
|
|
30
|
-
|
|
31
|
-
@Field
|
|
32
|
-
val hostedDomain: String? = null
|
|
33
|
-
|
|
34
|
-
@Field
|
|
35
|
-
val autoSelectEnabled: Boolean? = null
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Sign-in parameters
|
|
39
|
-
class SignInParams : Record {
|
|
40
|
-
@Field
|
|
41
|
-
val nonce: String? = null
|
|
42
|
-
|
|
43
|
-
@Field
|
|
44
|
-
val filterByAuthorizedAccounts: Boolean? = null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Create account parameters
|
|
48
|
-
class CreateAccountParams : Record {
|
|
49
|
-
@Field
|
|
50
|
-
val nonce: String? = null
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Explicit sign-in parameters
|
|
54
|
-
class ExplicitSignInParams : Record {
|
|
55
|
-
@Field
|
|
56
|
-
val nonce: String? = null
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Custom exceptions
|
|
60
|
-
class GoogleSignInCancelledException : CodedException("SIGN_IN_CANCELLED", "User cancelled the sign-in flow", null)
|
|
61
|
-
class GoogleSignInNoCredentialException : CodedException("NO_SAVED_CREDENTIAL_FOUND", "No saved credential found", null)
|
|
62
|
-
class GoogleSignInException(message: String) : CodedException("GOOGLE_SIGN_IN_ERROR", message, null)
|
|
63
|
-
class GoogleSignInNotConfiguredException : CodedException("NOT_CONFIGURED", "Google Sign-In is not configured. Call configure() first.", null)
|
|
64
|
-
class GoogleSignInActivityUnavailableException : CodedException("E_ACTIVITY_UNAVAILABLE", "Activity is not available", null)
|
|
65
|
-
|
|
66
|
-
class ClerkGoogleSignInModule : Module() {
|
|
67
|
-
private var webClientId: String? = null
|
|
68
|
-
private var hostedDomain: String? = null
|
|
69
|
-
private var autoSelectEnabled: Boolean = false
|
|
70
|
-
private val mainScope = CoroutineScope(Dispatchers.Main)
|
|
71
|
-
|
|
72
|
-
private val context: Context
|
|
73
|
-
get() = requireNotNull(appContext.reactContext)
|
|
74
|
-
|
|
75
|
-
private val credentialManager: CredentialManager
|
|
76
|
-
get() = CredentialManager.create(context)
|
|
77
|
-
|
|
78
|
-
override fun definition() = ModuleDefinition {
|
|
79
|
-
Name("ClerkGoogleSignIn")
|
|
80
|
-
|
|
81
|
-
// Configure the module
|
|
82
|
-
Function("configure") { params: ConfigureParams ->
|
|
83
|
-
webClientId = params.webClientId
|
|
84
|
-
hostedDomain = params.hostedDomain
|
|
85
|
-
autoSelectEnabled = params.autoSelectEnabled ?: false
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Sign in - attempts automatic sign-in with saved credentials
|
|
89
|
-
AsyncFunction("signIn") { params: SignInParams?, promise: Promise ->
|
|
90
|
-
val clientId = webClientId ?: run {
|
|
91
|
-
promise.reject(GoogleSignInNotConfiguredException())
|
|
92
|
-
return@AsyncFunction
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
val activity = appContext.currentActivity ?: run {
|
|
96
|
-
promise.reject(GoogleSignInActivityUnavailableException())
|
|
97
|
-
return@AsyncFunction
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
mainScope.launch {
|
|
101
|
-
try {
|
|
102
|
-
val googleIdOption = GetGoogleIdOption.Builder()
|
|
103
|
-
.setFilterByAuthorizedAccounts(params?.filterByAuthorizedAccounts ?: true)
|
|
104
|
-
.setServerClientId(clientId)
|
|
105
|
-
.setAutoSelectEnabled(autoSelectEnabled)
|
|
106
|
-
.apply {
|
|
107
|
-
params?.nonce?.let { setNonce(it) }
|
|
108
|
-
}
|
|
109
|
-
.build()
|
|
110
|
-
|
|
111
|
-
val request = GetCredentialRequest.Builder()
|
|
112
|
-
.addCredentialOption(googleIdOption)
|
|
113
|
-
.build()
|
|
114
|
-
|
|
115
|
-
val result = credentialManager.getCredential(
|
|
116
|
-
request = request,
|
|
117
|
-
context = activity
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
handleSignInResult(result, promise)
|
|
121
|
-
} catch (e: GetCredentialCancellationException) {
|
|
122
|
-
promise.reject(GoogleSignInCancelledException())
|
|
123
|
-
} catch (e: NoCredentialException) {
|
|
124
|
-
promise.reject(GoogleSignInNoCredentialException())
|
|
125
|
-
} catch (e: GetCredentialException) {
|
|
126
|
-
promise.reject(GoogleSignInException(e.message ?: "Unknown error"))
|
|
127
|
-
} catch (e: Exception) {
|
|
128
|
-
promise.reject(GoogleSignInException(e.message ?: "Unknown error"))
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Create account - shows account creation UI
|
|
134
|
-
AsyncFunction("createAccount") { params: CreateAccountParams?, promise: Promise ->
|
|
135
|
-
val clientId = webClientId ?: run {
|
|
136
|
-
promise.reject(GoogleSignInNotConfiguredException())
|
|
137
|
-
return@AsyncFunction
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
val activity = appContext.currentActivity ?: run {
|
|
141
|
-
promise.reject(GoogleSignInActivityUnavailableException())
|
|
142
|
-
return@AsyncFunction
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
mainScope.launch {
|
|
146
|
-
try {
|
|
147
|
-
val googleIdOption = GetGoogleIdOption.Builder()
|
|
148
|
-
.setFilterByAuthorizedAccounts(false) // Show all accounts for creation
|
|
149
|
-
.setServerClientId(clientId)
|
|
150
|
-
.apply {
|
|
151
|
-
params?.nonce?.let { setNonce(it) }
|
|
152
|
-
}
|
|
153
|
-
.build()
|
|
154
|
-
|
|
155
|
-
val request = GetCredentialRequest.Builder()
|
|
156
|
-
.addCredentialOption(googleIdOption)
|
|
157
|
-
.build()
|
|
158
|
-
|
|
159
|
-
val result = credentialManager.getCredential(
|
|
160
|
-
request = request,
|
|
161
|
-
context = activity
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
handleSignInResult(result, promise)
|
|
165
|
-
} catch (e: GetCredentialCancellationException) {
|
|
166
|
-
promise.reject(GoogleSignInCancelledException())
|
|
167
|
-
} catch (e: NoCredentialException) {
|
|
168
|
-
promise.reject(GoogleSignInNoCredentialException())
|
|
169
|
-
} catch (e: GetCredentialException) {
|
|
170
|
-
promise.reject(GoogleSignInException(e.message ?: "Unknown error"))
|
|
171
|
-
} catch (e: Exception) {
|
|
172
|
-
promise.reject(GoogleSignInException(e.message ?: "Unknown error"))
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Explicit sign-in - uses Sign In With Google button flow
|
|
178
|
-
AsyncFunction("presentExplicitSignIn") { params: ExplicitSignInParams?, promise: Promise ->
|
|
179
|
-
val clientId = webClientId ?: run {
|
|
180
|
-
promise.reject(GoogleSignInNotConfiguredException())
|
|
181
|
-
return@AsyncFunction
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
val activity = appContext.currentActivity ?: run {
|
|
185
|
-
promise.reject(GoogleSignInActivityUnavailableException())
|
|
186
|
-
return@AsyncFunction
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
mainScope.launch {
|
|
190
|
-
try {
|
|
191
|
-
val signInWithGoogleOption = GetSignInWithGoogleOption.Builder(clientId)
|
|
192
|
-
.apply {
|
|
193
|
-
params?.nonce?.let { setNonce(it) }
|
|
194
|
-
hostedDomain?.let { setHostedDomainFilter(it) }
|
|
195
|
-
}
|
|
196
|
-
.build()
|
|
197
|
-
|
|
198
|
-
val request = GetCredentialRequest.Builder()
|
|
199
|
-
.addCredentialOption(signInWithGoogleOption)
|
|
200
|
-
.build()
|
|
201
|
-
|
|
202
|
-
val result = credentialManager.getCredential(
|
|
203
|
-
request = request,
|
|
204
|
-
context = activity
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
handleSignInResult(result, promise)
|
|
208
|
-
} catch (e: GetCredentialCancellationException) {
|
|
209
|
-
promise.reject(GoogleSignInCancelledException())
|
|
210
|
-
} catch (e: GetCredentialException) {
|
|
211
|
-
promise.reject(GoogleSignInException(e.message ?: "Unknown error"))
|
|
212
|
-
} catch (e: Exception) {
|
|
213
|
-
promise.reject(GoogleSignInException(e.message ?: "Unknown error"))
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Sign out - clears credential state
|
|
219
|
-
AsyncFunction("signOut") { promise: Promise ->
|
|
220
|
-
mainScope.launch {
|
|
221
|
-
try {
|
|
222
|
-
credentialManager.clearCredentialState(ClearCredentialStateRequest())
|
|
223
|
-
promise.resolve(null)
|
|
224
|
-
} catch (e: Exception) {
|
|
225
|
-
promise.reject(GoogleSignInException(e.message ?: "Failed to sign out"))
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
private fun handleSignInResult(result: GetCredentialResponse, promise: Promise) {
|
|
232
|
-
when (val credential = result.credential) {
|
|
233
|
-
is CustomCredential -> {
|
|
234
|
-
if (credential.type == GoogleIdTokenCredential.TYPE_GOOGLE_ID_TOKEN_CREDENTIAL) {
|
|
235
|
-
try {
|
|
236
|
-
val googleIdTokenCredential = GoogleIdTokenCredential.createFrom(credential.data)
|
|
237
|
-
|
|
238
|
-
promise.resolve(mapOf(
|
|
239
|
-
"type" to "success",
|
|
240
|
-
"data" to mapOf(
|
|
241
|
-
"idToken" to googleIdTokenCredential.idToken,
|
|
242
|
-
"user" to mapOf(
|
|
243
|
-
"id" to googleIdTokenCredential.id,
|
|
244
|
-
"email" to googleIdTokenCredential.id,
|
|
245
|
-
"name" to googleIdTokenCredential.displayName,
|
|
246
|
-
"givenName" to googleIdTokenCredential.givenName,
|
|
247
|
-
"familyName" to googleIdTokenCredential.familyName,
|
|
248
|
-
"photo" to googleIdTokenCredential.profilePictureUri?.toString()
|
|
249
|
-
)
|
|
250
|
-
)
|
|
251
|
-
))
|
|
252
|
-
} catch (e: GoogleIdTokenParsingException) {
|
|
253
|
-
promise.reject(GoogleSignInException("Failed to parse Google ID token: ${e.message}"))
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
256
|
-
promise.reject(GoogleSignInException("Unexpected credential type: ${credential.type}"))
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
else -> {
|
|
260
|
-
promise.reject(GoogleSignInException("Unexpected credential type"))
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
package/app.plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./plugin/build/withClerkExpo');
|
|
@@ -1,104 +0,0 @@
|
|
|
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 a code property (Google Sign-In error).
|
|
16
|
-
*/
|
|
17
|
-
export declare function isErrorWithCode(error: unknown): error is {
|
|
18
|
-
code: string;
|
|
19
|
-
message: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Clerk's Google One Tap Sign-In module for Android.
|
|
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
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import { ClerkGoogleOneTapSignIn } from '@clerk/clerk-expo';
|
|
30
|
-
* import * as Crypto from 'expo-crypto';
|
|
31
|
-
*
|
|
32
|
-
* // Configure once at app startup
|
|
33
|
-
* ClerkGoogleOneTapSignIn.configure({
|
|
34
|
-
* webClientId: 'YOUR_WEB_CLIENT_ID',
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* // Sign in with nonce
|
|
38
|
-
* const nonce = Crypto.randomUUID();
|
|
39
|
-
* const response = await ClerkGoogleOneTapSignIn.signIn({ nonce });
|
|
40
|
-
*
|
|
41
|
-
* if (response.type === 'success') {
|
|
42
|
-
* const { idToken } = response.data;
|
|
43
|
-
* // Use idToken with Clerk
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @platform Android
|
|
48
|
-
*/
|
|
49
|
-
export declare const ClerkGoogleOneTapSignIn: {
|
|
50
|
-
/**
|
|
51
|
-
* Configure Google Sign-In. Must be called before any sign-in methods.
|
|
52
|
-
*
|
|
53
|
-
* @param params - Configuration parameters
|
|
54
|
-
* @param params.webClientId - The web client ID from Google Cloud Console (required)
|
|
55
|
-
* @param params.hostedDomain - Optional domain restriction
|
|
56
|
-
* @param params.autoSelectEnabled - Auto-select for single credential (default: false)
|
|
57
|
-
*/
|
|
58
|
-
configure(params: ConfigureParams): void;
|
|
59
|
-
/**
|
|
60
|
-
* Attempt to sign in with saved credentials (One Tap).
|
|
61
|
-
*
|
|
62
|
-
* This method will show the One Tap UI if there are saved credentials,
|
|
63
|
-
* or return a "noSavedCredentialFound" response if there are none.
|
|
64
|
-
*
|
|
65
|
-
* @param params - Sign-in parameters
|
|
66
|
-
* @param params.nonce - Cryptographic nonce for replay protection
|
|
67
|
-
* @param params.filterByAuthorizedAccounts - Only show previously authorized accounts (default: true)
|
|
68
|
-
*
|
|
69
|
-
* @returns Promise resolving to OneTapResponse
|
|
70
|
-
*/
|
|
71
|
-
signIn(params?: SignInParams): Promise<OneTapResponse>;
|
|
72
|
-
/**
|
|
73
|
-
* Create a new account (shows all Google accounts).
|
|
74
|
-
*
|
|
75
|
-
* This method shows the account picker with all available Google accounts,
|
|
76
|
-
* not just previously authorized ones.
|
|
77
|
-
*
|
|
78
|
-
* @param params - Create account parameters
|
|
79
|
-
* @param params.nonce - Cryptographic nonce for replay protection
|
|
80
|
-
*
|
|
81
|
-
* @returns Promise resolving to OneTapResponse
|
|
82
|
-
*/
|
|
83
|
-
createAccount(params?: CreateAccountParams): Promise<OneTapResponse>;
|
|
84
|
-
/**
|
|
85
|
-
* Present explicit sign-in UI (Google Sign-In button flow).
|
|
86
|
-
*
|
|
87
|
-
* This shows the full Google Sign-In UI, similar to clicking a
|
|
88
|
-
* "Sign in with Google" button.
|
|
89
|
-
*
|
|
90
|
-
* @param params - Explicit sign-in parameters
|
|
91
|
-
* @param params.nonce - Cryptographic nonce for replay protection
|
|
92
|
-
*
|
|
93
|
-
* @returns Promise resolving to OneTapResponse
|
|
94
|
-
*/
|
|
95
|
-
presentExplicitSignIn(params?: ExplicitSignInParams): Promise<OneTapResponse>;
|
|
96
|
-
/**
|
|
97
|
-
* Sign out and clear credential state.
|
|
98
|
-
*
|
|
99
|
-
* This disables automatic sign-in until the user signs in again.
|
|
100
|
-
*/
|
|
101
|
-
signOut(): Promise<void>;
|
|
102
|
-
};
|
|
103
|
-
export type { ConfigureParams, SignInParams, CreateAccountParams, ExplicitSignInParams, OneTapResponse, OneTapSuccessResponse, CancelledResponse, NoSavedCredentialFound, GoogleUser, } from './types';
|
|
104
|
-
//# sourceMappingURL=ClerkGoogleOneTapSignIn.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClerkGoogleOneTapSignIn.d.ts","sourceRoot":"","sources":["../../src/google-one-tap/ClerkGoogleOneTapSignIn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACb,MAAM,SAAS,CAAC;AAqBjB;;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,CAO1F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;;;;;OAOG;sBACe,eAAe,GAAG,IAAI;IAIxC;;;;;;;;;;;OAWG;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"}
|