@better-auth/sso 1.4.0-beta.2 → 1.4.0-beta.3
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/.turbo/turbo-build.log +4 -4
- package/dist/index.cjs +53 -117
- package/dist/index.mjs +53 -117
- package/package.json +5 -5
- package/src/index.ts +65 -135
- package/tsconfig.json +9 -15
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/sso@1.4.0-beta.
|
|
2
|
+
> @better-auth/sso@1.4.0-beta.3 build /home/runner/work/better-auth/better-auth/packages/sso
|
|
3
3
|
> unbuild
|
|
4
4
|
|
|
5
5
|
[info] Automatically detected entries: src/index, src/client [esm] [cjs] [dts]
|
|
6
6
|
[info] Building sso
|
|
7
7
|
[success] Build succeeded for sso
|
|
8
|
-
[log] dist/index.cjs (total size:
|
|
8
|
+
[log] dist/index.cjs (total size: 64.5 kB, chunk size: 64.5 kB, exports: sso)
|
|
9
9
|
|
|
10
10
|
[log] dist/client.cjs (total size: 141 B, chunk size: 141 B, exports: ssoClient)
|
|
11
11
|
|
|
12
|
-
[log] dist/index.mjs (total size:
|
|
12
|
+
[log] dist/index.mjs (total size: 62.9 kB, chunk size: 62.9 kB, exports: sso)
|
|
13
13
|
|
|
14
14
|
[log] dist/client.mjs (total size: 117 B, chunk size: 117 B, exports: ssoClient)
|
|
15
15
|
|
|
16
|
-
Σ Total dist size (byte size):
|
|
16
|
+
Σ Total dist size (byte size): 255 kB
|
|
17
17
|
[log]
|
package/dist/index.cjs
CHANGED
|
@@ -91,71 +91,37 @@ const sso = (options) => {
|
|
|
91
91
|
{
|
|
92
92
|
method: "POST",
|
|
93
93
|
body: z__namespace.object({
|
|
94
|
-
providerId: z__namespace.string({}).
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
issuer: z__namespace.string({}).
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
description: "The domain of the provider. This is used for email matching"
|
|
102
|
-
}),
|
|
94
|
+
providerId: z__namespace.string({}).describe(
|
|
95
|
+
"The ID of the provider. This is used to identify the provider during login and callback"
|
|
96
|
+
),
|
|
97
|
+
issuer: z__namespace.string({}).describe("The issuer of the provider"),
|
|
98
|
+
domain: z__namespace.string({}).describe(
|
|
99
|
+
"The domain of the provider. This is used for email matching"
|
|
100
|
+
),
|
|
103
101
|
oidcConfig: z__namespace.object({
|
|
104
|
-
clientId: z__namespace.string({}).
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}),
|
|
110
|
-
authorizationEndpoint: z__namespace.string({}).meta({
|
|
111
|
-
description: "The authorization endpoint"
|
|
112
|
-
}).optional(),
|
|
113
|
-
tokenEndpoint: z__namespace.string({}).meta({
|
|
114
|
-
description: "The token endpoint"
|
|
115
|
-
}).optional(),
|
|
116
|
-
userInfoEndpoint: z__namespace.string({}).meta({
|
|
117
|
-
description: "The user info endpoint"
|
|
118
|
-
}).optional(),
|
|
102
|
+
clientId: z__namespace.string({}).describe("The client ID"),
|
|
103
|
+
clientSecret: z__namespace.string({}).describe("The client secret"),
|
|
104
|
+
authorizationEndpoint: z__namespace.string({}).describe("The authorization endpoint").optional(),
|
|
105
|
+
tokenEndpoint: z__namespace.string({}).describe("The token endpoint").optional(),
|
|
106
|
+
userInfoEndpoint: z__namespace.string({}).describe("The user info endpoint").optional(),
|
|
119
107
|
tokenEndpointAuthentication: z__namespace.enum(["client_secret_post", "client_secret_basic"]).optional(),
|
|
120
|
-
jwksEndpoint: z__namespace.string({}).
|
|
121
|
-
description: "The JWKS endpoint"
|
|
122
|
-
}).optional(),
|
|
108
|
+
jwksEndpoint: z__namespace.string({}).describe("The JWKS endpoint").optional(),
|
|
123
109
|
discoveryEndpoint: z__namespace.string().optional(),
|
|
124
|
-
scopes: z__namespace.array(z__namespace.string(), {}).
|
|
125
|
-
|
|
126
|
-
}).optional(),
|
|
127
|
-
pkce: z__namespace.boolean({}).meta({
|
|
128
|
-
description: "Whether to use PKCE for the authorization flow"
|
|
129
|
-
}).default(true).optional(),
|
|
110
|
+
scopes: z__namespace.array(z__namespace.string(), {}).describe("The scopes to request. ").optional(),
|
|
111
|
+
pkce: z__namespace.boolean({}).describe("Whether to use PKCE for the authorization flow").default(true).optional(),
|
|
130
112
|
mapping: z__namespace.object({
|
|
131
|
-
id: z__namespace.string({}).
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}),
|
|
137
|
-
emailVerified: z__namespace.string({}).meta({
|
|
138
|
-
description: "Field mapping for email verification (defaults to 'email_verified')"
|
|
139
|
-
}).optional(),
|
|
140
|
-
name: z__namespace.string({}).meta({
|
|
141
|
-
description: "Field mapping for name (defaults to 'name')"
|
|
142
|
-
}),
|
|
143
|
-
image: z__namespace.string({}).meta({
|
|
144
|
-
description: "Field mapping for image (defaults to 'picture')"
|
|
145
|
-
}).optional(),
|
|
113
|
+
id: z__namespace.string({}).describe("Field mapping for user ID ("),
|
|
114
|
+
email: z__namespace.string({}).describe("Field mapping for email ("),
|
|
115
|
+
emailVerified: z__namespace.string({}).describe("Field mapping for email verification (").optional(),
|
|
116
|
+
name: z__namespace.string({}).describe("Field mapping for name ("),
|
|
117
|
+
image: z__namespace.string({}).describe("Field mapping for image (").optional(),
|
|
146
118
|
extraFields: z__namespace.record(z__namespace.string(), z__namespace.any()).optional()
|
|
147
119
|
}).optional()
|
|
148
120
|
}).optional(),
|
|
149
121
|
samlConfig: z__namespace.object({
|
|
150
|
-
entryPoint: z__namespace.string({}).
|
|
151
|
-
|
|
152
|
-
}),
|
|
153
|
-
cert: z__namespace.string({}).meta({
|
|
154
|
-
description: "The certificate of the provider"
|
|
155
|
-
}),
|
|
156
|
-
callbackUrl: z__namespace.string({}).meta({
|
|
157
|
-
description: "The callback URL of the provider"
|
|
158
|
-
}),
|
|
122
|
+
entryPoint: z__namespace.string({}).describe("The entry point of the provider"),
|
|
123
|
+
cert: z__namespace.string({}).describe("The certificate of the provider"),
|
|
124
|
+
callbackUrl: z__namespace.string({}).describe("The callback URL of the provider"),
|
|
159
125
|
audience: z__namespace.string().optional(),
|
|
160
126
|
idpMetadata: z__namespace.object({
|
|
161
127
|
metadata: z__namespace.string().optional(),
|
|
@@ -168,16 +134,10 @@ const sso = (options) => {
|
|
|
168
134
|
encPrivateKeyPass: z__namespace.string().optional(),
|
|
169
135
|
singleSignOnService: z__namespace.array(
|
|
170
136
|
z__namespace.object({
|
|
171
|
-
Binding: z__namespace.string().
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
Location: z__namespace.string().meta({
|
|
175
|
-
description: "The URL for the SSO service"
|
|
176
|
-
})
|
|
137
|
+
Binding: z__namespace.string().describe("The binding type for the SSO service"),
|
|
138
|
+
Location: z__namespace.string().describe("The URL for the SSO service")
|
|
177
139
|
})
|
|
178
|
-
).optional().
|
|
179
|
-
description: "Single Sign-On service configuration"
|
|
180
|
-
})
|
|
140
|
+
).optional().describe("Single Sign-On service configuration")
|
|
181
141
|
}).optional(),
|
|
182
142
|
spMetadata: z__namespace.object({
|
|
183
143
|
metadata: z__namespace.string().optional(),
|
|
@@ -197,33 +157,21 @@ const sso = (options) => {
|
|
|
197
157
|
decryptionPvk: z__namespace.string().optional(),
|
|
198
158
|
additionalParams: z__namespace.record(z__namespace.string(), z__namespace.any()).optional(),
|
|
199
159
|
mapping: z__namespace.object({
|
|
200
|
-
id: z__namespace.string({}).
|
|
201
|
-
|
|
202
|
-
}),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
emailVerified: z__namespace.string({}).meta({
|
|
207
|
-
description: "Field mapping for email verification"
|
|
208
|
-
}).optional(),
|
|
209
|
-
name: z__namespace.string({}).meta({
|
|
210
|
-
description: "Field mapping for name (defaults to 'displayName')"
|
|
211
|
-
}),
|
|
212
|
-
firstName: z__namespace.string({}).meta({
|
|
213
|
-
description: "Field mapping for first name (defaults to 'givenName')"
|
|
214
|
-
}).optional(),
|
|
215
|
-
lastName: z__namespace.string({}).meta({
|
|
216
|
-
description: "Field mapping for last name (defaults to 'surname')"
|
|
217
|
-
}).optional(),
|
|
160
|
+
id: z__namespace.string({}).describe("Field mapping for user ID ("),
|
|
161
|
+
email: z__namespace.string({}).describe("Field mapping for email ("),
|
|
162
|
+
emailVerified: z__namespace.string({}).describe("Field mapping for email verification").optional(),
|
|
163
|
+
name: z__namespace.string({}).describe("Field mapping for name ("),
|
|
164
|
+
firstName: z__namespace.string({}).describe("Field mapping for first name (").optional(),
|
|
165
|
+
lastName: z__namespace.string({}).describe("Field mapping for last name (").optional(),
|
|
218
166
|
extraFields: z__namespace.record(z__namespace.string(), z__namespace.any()).optional()
|
|
219
167
|
}).optional()
|
|
220
168
|
}).optional(),
|
|
221
|
-
organizationId: z__namespace.string({}).
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
overrideUserInfo: z__namespace.boolean({}).
|
|
225
|
-
|
|
226
|
-
|
|
169
|
+
organizationId: z__namespace.string({}).describe(
|
|
170
|
+
"If organization plugin is enabled, the organization id to link the provider to"
|
|
171
|
+
).optional(),
|
|
172
|
+
overrideUserInfo: z__namespace.boolean({}).describe(
|
|
173
|
+
"Override user info with the provider info. Defaults to false"
|
|
174
|
+
).default(false).optional()
|
|
227
175
|
}),
|
|
228
176
|
use: [api.sessionMiddleware],
|
|
229
177
|
metadata: {
|
|
@@ -497,33 +445,21 @@ const sso = (options) => {
|
|
|
497
445
|
{
|
|
498
446
|
method: "POST",
|
|
499
447
|
body: z__namespace.object({
|
|
500
|
-
email: z__namespace.string({}).
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
organizationSlug: z__namespace.string({}).
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}).
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}).optional(),
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
errorCallbackURL: z__namespace.string({}).meta({
|
|
516
|
-
description: "The URL to redirect to after login"
|
|
517
|
-
}).optional(),
|
|
518
|
-
newUserCallbackURL: z__namespace.string({}).meta({
|
|
519
|
-
description: "The URL to redirect to after login if the user is new"
|
|
520
|
-
}).optional(),
|
|
521
|
-
scopes: z__namespace.array(z__namespace.string(), {}).meta({
|
|
522
|
-
description: "Scopes to request from the provider."
|
|
523
|
-
}).optional(),
|
|
524
|
-
requestSignUp: z__namespace.boolean({}).meta({
|
|
525
|
-
description: "Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider"
|
|
526
|
-
}).optional(),
|
|
448
|
+
email: z__namespace.string({}).describe(
|
|
449
|
+
"The email address to sign in with. This is used to identify the issuer to sign in with"
|
|
450
|
+
).optional(),
|
|
451
|
+
organizationSlug: z__namespace.string({}).describe("The slug of the organization to sign in with").optional(),
|
|
452
|
+
providerId: z__namespace.string({}).describe(
|
|
453
|
+
"The ID of the provider to sign in with. This can be provided instead of email or issuer"
|
|
454
|
+
).optional(),
|
|
455
|
+
domain: z__namespace.string({}).describe("The domain of the provider.").optional(),
|
|
456
|
+
callbackURL: z__namespace.string({}).describe("The URL to redirect to after login"),
|
|
457
|
+
errorCallbackURL: z__namespace.string({}).describe("The URL to redirect to after login").optional(),
|
|
458
|
+
newUserCallbackURL: z__namespace.string({}).describe("The URL to redirect to after login if the user is new").optional(),
|
|
459
|
+
scopes: z__namespace.array(z__namespace.string(), {}).describe("Scopes to request from the provider.").optional(),
|
|
460
|
+
requestSignUp: z__namespace.boolean({}).describe(
|
|
461
|
+
"Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider"
|
|
462
|
+
).optional(),
|
|
527
463
|
providerType: z__namespace.enum(["oidc", "saml"]).optional()
|
|
528
464
|
}),
|
|
529
465
|
metadata: {
|
package/dist/index.mjs
CHANGED
|
@@ -74,71 +74,37 @@ const sso = (options) => {
|
|
|
74
74
|
{
|
|
75
75
|
method: "POST",
|
|
76
76
|
body: z.object({
|
|
77
|
-
providerId: z.string({}).
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
issuer: z.string({}).
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
description: "The domain of the provider. This is used for email matching"
|
|
85
|
-
}),
|
|
77
|
+
providerId: z.string({}).describe(
|
|
78
|
+
"The ID of the provider. This is used to identify the provider during login and callback"
|
|
79
|
+
),
|
|
80
|
+
issuer: z.string({}).describe("The issuer of the provider"),
|
|
81
|
+
domain: z.string({}).describe(
|
|
82
|
+
"The domain of the provider. This is used for email matching"
|
|
83
|
+
),
|
|
86
84
|
oidcConfig: z.object({
|
|
87
|
-
clientId: z.string({}).
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
authorizationEndpoint: z.string({}).meta({
|
|
94
|
-
description: "The authorization endpoint"
|
|
95
|
-
}).optional(),
|
|
96
|
-
tokenEndpoint: z.string({}).meta({
|
|
97
|
-
description: "The token endpoint"
|
|
98
|
-
}).optional(),
|
|
99
|
-
userInfoEndpoint: z.string({}).meta({
|
|
100
|
-
description: "The user info endpoint"
|
|
101
|
-
}).optional(),
|
|
85
|
+
clientId: z.string({}).describe("The client ID"),
|
|
86
|
+
clientSecret: z.string({}).describe("The client secret"),
|
|
87
|
+
authorizationEndpoint: z.string({}).describe("The authorization endpoint").optional(),
|
|
88
|
+
tokenEndpoint: z.string({}).describe("The token endpoint").optional(),
|
|
89
|
+
userInfoEndpoint: z.string({}).describe("The user info endpoint").optional(),
|
|
102
90
|
tokenEndpointAuthentication: z.enum(["client_secret_post", "client_secret_basic"]).optional(),
|
|
103
|
-
jwksEndpoint: z.string({}).
|
|
104
|
-
description: "The JWKS endpoint"
|
|
105
|
-
}).optional(),
|
|
91
|
+
jwksEndpoint: z.string({}).describe("The JWKS endpoint").optional(),
|
|
106
92
|
discoveryEndpoint: z.string().optional(),
|
|
107
|
-
scopes: z.array(z.string(), {}).
|
|
108
|
-
|
|
109
|
-
}).optional(),
|
|
110
|
-
pkce: z.boolean({}).meta({
|
|
111
|
-
description: "Whether to use PKCE for the authorization flow"
|
|
112
|
-
}).default(true).optional(),
|
|
93
|
+
scopes: z.array(z.string(), {}).describe("The scopes to request. ").optional(),
|
|
94
|
+
pkce: z.boolean({}).describe("Whether to use PKCE for the authorization flow").default(true).optional(),
|
|
113
95
|
mapping: z.object({
|
|
114
|
-
id: z.string({}).
|
|
115
|
-
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}),
|
|
120
|
-
emailVerified: z.string({}).meta({
|
|
121
|
-
description: "Field mapping for email verification (defaults to 'email_verified')"
|
|
122
|
-
}).optional(),
|
|
123
|
-
name: z.string({}).meta({
|
|
124
|
-
description: "Field mapping for name (defaults to 'name')"
|
|
125
|
-
}),
|
|
126
|
-
image: z.string({}).meta({
|
|
127
|
-
description: "Field mapping for image (defaults to 'picture')"
|
|
128
|
-
}).optional(),
|
|
96
|
+
id: z.string({}).describe("Field mapping for user ID ("),
|
|
97
|
+
email: z.string({}).describe("Field mapping for email ("),
|
|
98
|
+
emailVerified: z.string({}).describe("Field mapping for email verification (").optional(),
|
|
99
|
+
name: z.string({}).describe("Field mapping for name ("),
|
|
100
|
+
image: z.string({}).describe("Field mapping for image (").optional(),
|
|
129
101
|
extraFields: z.record(z.string(), z.any()).optional()
|
|
130
102
|
}).optional()
|
|
131
103
|
}).optional(),
|
|
132
104
|
samlConfig: z.object({
|
|
133
|
-
entryPoint: z.string({}).
|
|
134
|
-
|
|
135
|
-
}),
|
|
136
|
-
cert: z.string({}).meta({
|
|
137
|
-
description: "The certificate of the provider"
|
|
138
|
-
}),
|
|
139
|
-
callbackUrl: z.string({}).meta({
|
|
140
|
-
description: "The callback URL of the provider"
|
|
141
|
-
}),
|
|
105
|
+
entryPoint: z.string({}).describe("The entry point of the provider"),
|
|
106
|
+
cert: z.string({}).describe("The certificate of the provider"),
|
|
107
|
+
callbackUrl: z.string({}).describe("The callback URL of the provider"),
|
|
142
108
|
audience: z.string().optional(),
|
|
143
109
|
idpMetadata: z.object({
|
|
144
110
|
metadata: z.string().optional(),
|
|
@@ -151,16 +117,10 @@ const sso = (options) => {
|
|
|
151
117
|
encPrivateKeyPass: z.string().optional(),
|
|
152
118
|
singleSignOnService: z.array(
|
|
153
119
|
z.object({
|
|
154
|
-
Binding: z.string().
|
|
155
|
-
|
|
156
|
-
}),
|
|
157
|
-
Location: z.string().meta({
|
|
158
|
-
description: "The URL for the SSO service"
|
|
159
|
-
})
|
|
120
|
+
Binding: z.string().describe("The binding type for the SSO service"),
|
|
121
|
+
Location: z.string().describe("The URL for the SSO service")
|
|
160
122
|
})
|
|
161
|
-
).optional().
|
|
162
|
-
description: "Single Sign-On service configuration"
|
|
163
|
-
})
|
|
123
|
+
).optional().describe("Single Sign-On service configuration")
|
|
164
124
|
}).optional(),
|
|
165
125
|
spMetadata: z.object({
|
|
166
126
|
metadata: z.string().optional(),
|
|
@@ -180,33 +140,21 @@ const sso = (options) => {
|
|
|
180
140
|
decryptionPvk: z.string().optional(),
|
|
181
141
|
additionalParams: z.record(z.string(), z.any()).optional(),
|
|
182
142
|
mapping: z.object({
|
|
183
|
-
id: z.string({}).
|
|
184
|
-
|
|
185
|
-
}),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}),
|
|
189
|
-
emailVerified: z.string({}).meta({
|
|
190
|
-
description: "Field mapping for email verification"
|
|
191
|
-
}).optional(),
|
|
192
|
-
name: z.string({}).meta({
|
|
193
|
-
description: "Field mapping for name (defaults to 'displayName')"
|
|
194
|
-
}),
|
|
195
|
-
firstName: z.string({}).meta({
|
|
196
|
-
description: "Field mapping for first name (defaults to 'givenName')"
|
|
197
|
-
}).optional(),
|
|
198
|
-
lastName: z.string({}).meta({
|
|
199
|
-
description: "Field mapping for last name (defaults to 'surname')"
|
|
200
|
-
}).optional(),
|
|
143
|
+
id: z.string({}).describe("Field mapping for user ID ("),
|
|
144
|
+
email: z.string({}).describe("Field mapping for email ("),
|
|
145
|
+
emailVerified: z.string({}).describe("Field mapping for email verification").optional(),
|
|
146
|
+
name: z.string({}).describe("Field mapping for name ("),
|
|
147
|
+
firstName: z.string({}).describe("Field mapping for first name (").optional(),
|
|
148
|
+
lastName: z.string({}).describe("Field mapping for last name (").optional(),
|
|
201
149
|
extraFields: z.record(z.string(), z.any()).optional()
|
|
202
150
|
}).optional()
|
|
203
151
|
}).optional(),
|
|
204
|
-
organizationId: z.string({}).
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
overrideUserInfo: z.boolean({}).
|
|
208
|
-
|
|
209
|
-
|
|
152
|
+
organizationId: z.string({}).describe(
|
|
153
|
+
"If organization plugin is enabled, the organization id to link the provider to"
|
|
154
|
+
).optional(),
|
|
155
|
+
overrideUserInfo: z.boolean({}).describe(
|
|
156
|
+
"Override user info with the provider info. Defaults to false"
|
|
157
|
+
).default(false).optional()
|
|
210
158
|
}),
|
|
211
159
|
use: [sessionMiddleware],
|
|
212
160
|
metadata: {
|
|
@@ -480,33 +428,21 @@ const sso = (options) => {
|
|
|
480
428
|
{
|
|
481
429
|
method: "POST",
|
|
482
430
|
body: z.object({
|
|
483
|
-
email: z.string({}).
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
organizationSlug: z.string({}).
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}).
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}).optional(),
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
errorCallbackURL: z.string({}).meta({
|
|
499
|
-
description: "The URL to redirect to after login"
|
|
500
|
-
}).optional(),
|
|
501
|
-
newUserCallbackURL: z.string({}).meta({
|
|
502
|
-
description: "The URL to redirect to after login if the user is new"
|
|
503
|
-
}).optional(),
|
|
504
|
-
scopes: z.array(z.string(), {}).meta({
|
|
505
|
-
description: "Scopes to request from the provider."
|
|
506
|
-
}).optional(),
|
|
507
|
-
requestSignUp: z.boolean({}).meta({
|
|
508
|
-
description: "Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider"
|
|
509
|
-
}).optional(),
|
|
431
|
+
email: z.string({}).describe(
|
|
432
|
+
"The email address to sign in with. This is used to identify the issuer to sign in with"
|
|
433
|
+
).optional(),
|
|
434
|
+
organizationSlug: z.string({}).describe("The slug of the organization to sign in with").optional(),
|
|
435
|
+
providerId: z.string({}).describe(
|
|
436
|
+
"The ID of the provider to sign in with. This can be provided instead of email or issuer"
|
|
437
|
+
).optional(),
|
|
438
|
+
domain: z.string({}).describe("The domain of the provider.").optional(),
|
|
439
|
+
callbackURL: z.string({}).describe("The URL to redirect to after login"),
|
|
440
|
+
errorCallbackURL: z.string({}).describe("The URL to redirect to after login").optional(),
|
|
441
|
+
newUserCallbackURL: z.string({}).describe("The URL to redirect to after login if the user is new").optional(),
|
|
442
|
+
scopes: z.array(z.string(), {}).describe("Scopes to request from the provider.").optional(),
|
|
443
|
+
requestSignUp: z.boolean({}).describe(
|
|
444
|
+
"Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider"
|
|
445
|
+
).optional(),
|
|
510
446
|
providerType: z.enum(["oidc", "saml"]).optional()
|
|
511
447
|
}),
|
|
512
448
|
metadata: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/sso",
|
|
3
3
|
"author": "Bereket Engida",
|
|
4
|
-
"version": "1.4.0-beta.
|
|
4
|
+
"version": "1.4.0-beta.3",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"body-parser": "^2.2.0",
|
|
59
59
|
"express": "^5.1.0",
|
|
60
60
|
"unbuild": "3.6.1",
|
|
61
|
-
"better-auth": "^1.4.0-beta.
|
|
61
|
+
"better-auth": "^1.4.0-beta.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"better-auth": "1.4.0-beta.
|
|
64
|
+
"better-auth": "1.4.0-beta.3"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"test": "vitest",
|
|
68
68
|
"build": "unbuild",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"dev": "unbuild --watch",
|
|
70
|
+
"typecheck": "tsc --project tsconfig.json"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -284,95 +284,62 @@ export const sso = (options?: SSOOptions) => {
|
|
|
284
284
|
{
|
|
285
285
|
method: "POST",
|
|
286
286
|
body: z.object({
|
|
287
|
-
providerId: z
|
|
288
|
-
|
|
287
|
+
providerId: z
|
|
288
|
+
.string({})
|
|
289
|
+
.describe(
|
|
289
290
|
"The ID of the provider. This is used to identify the provider during login and callback",
|
|
290
|
-
|
|
291
|
-
issuer: z.string({}).
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
description:
|
|
291
|
+
),
|
|
292
|
+
issuer: z.string({}).describe("The issuer of the provider"),
|
|
293
|
+
domain: z
|
|
294
|
+
.string({})
|
|
295
|
+
.describe(
|
|
296
296
|
"The domain of the provider. This is used for email matching",
|
|
297
|
-
|
|
297
|
+
),
|
|
298
298
|
oidcConfig: z
|
|
299
299
|
.object({
|
|
300
|
-
clientId: z.string({}).
|
|
301
|
-
|
|
302
|
-
}),
|
|
303
|
-
clientSecret: z.string({}).meta({
|
|
304
|
-
description: "The client secret",
|
|
305
|
-
}),
|
|
300
|
+
clientId: z.string({}).describe("The client ID"),
|
|
301
|
+
clientSecret: z.string({}).describe("The client secret"),
|
|
306
302
|
authorizationEndpoint: z
|
|
307
303
|
.string({})
|
|
308
|
-
.
|
|
309
|
-
description: "The authorization endpoint",
|
|
310
|
-
})
|
|
304
|
+
.describe("The authorization endpoint")
|
|
311
305
|
.optional(),
|
|
312
306
|
tokenEndpoint: z
|
|
313
307
|
.string({})
|
|
314
|
-
.
|
|
315
|
-
description: "The token endpoint",
|
|
316
|
-
})
|
|
308
|
+
.describe("The token endpoint")
|
|
317
309
|
.optional(),
|
|
318
310
|
userInfoEndpoint: z
|
|
319
311
|
.string({})
|
|
320
|
-
.
|
|
321
|
-
description: "The user info endpoint",
|
|
322
|
-
})
|
|
312
|
+
.describe("The user info endpoint")
|
|
323
313
|
.optional(),
|
|
324
314
|
tokenEndpointAuthentication: z
|
|
325
315
|
.enum(["client_secret_post", "client_secret_basic"])
|
|
326
316
|
.optional(),
|
|
327
317
|
jwksEndpoint: z
|
|
328
318
|
.string({})
|
|
329
|
-
.
|
|
330
|
-
description: "The JWKS endpoint",
|
|
331
|
-
})
|
|
319
|
+
.describe("The JWKS endpoint")
|
|
332
320
|
.optional(),
|
|
333
321
|
discoveryEndpoint: z.string().optional(),
|
|
334
322
|
scopes: z
|
|
335
323
|
.array(z.string(), {})
|
|
336
|
-
.
|
|
337
|
-
description:
|
|
338
|
-
"The scopes to request. Defaults to ['openid', 'email', 'profile', 'offline_access']",
|
|
339
|
-
})
|
|
324
|
+
.describe("The scopes to request. ")
|
|
340
325
|
.optional(),
|
|
341
326
|
pkce: z
|
|
342
327
|
.boolean({})
|
|
343
|
-
.
|
|
344
|
-
description:
|
|
345
|
-
"Whether to use PKCE for the authorization flow",
|
|
346
|
-
})
|
|
328
|
+
.describe("Whether to use PKCE for the authorization flow")
|
|
347
329
|
.default(true)
|
|
348
330
|
.optional(),
|
|
349
331
|
mapping: z
|
|
350
332
|
.object({
|
|
351
|
-
id: z.string({}).
|
|
352
|
-
|
|
353
|
-
"Field mapping for user ID (defaults to 'sub')",
|
|
354
|
-
}),
|
|
355
|
-
email: z.string({}).meta({
|
|
356
|
-
description:
|
|
357
|
-
"Field mapping for email (defaults to 'email')",
|
|
358
|
-
}),
|
|
333
|
+
id: z.string({}).describe("Field mapping for user ID ("),
|
|
334
|
+
email: z.string({}).describe("Field mapping for email ("),
|
|
359
335
|
emailVerified: z
|
|
360
336
|
.string({})
|
|
361
|
-
.
|
|
362
|
-
description:
|
|
363
|
-
"Field mapping for email verification (defaults to 'email_verified')",
|
|
364
|
-
})
|
|
337
|
+
.describe("Field mapping for email verification (")
|
|
365
338
|
.optional(),
|
|
366
|
-
name: z.string({}).
|
|
367
|
-
description:
|
|
368
|
-
"Field mapping for name (defaults to 'name')",
|
|
369
|
-
}),
|
|
339
|
+
name: z.string({}).describe("Field mapping for name ("),
|
|
370
340
|
image: z
|
|
371
341
|
.string({})
|
|
372
|
-
.
|
|
373
|
-
description:
|
|
374
|
-
"Field mapping for image (defaults to 'picture')",
|
|
375
|
-
})
|
|
342
|
+
.describe("Field mapping for image (")
|
|
376
343
|
.optional(),
|
|
377
344
|
extraFields: z.record(z.string(), z.any()).optional(),
|
|
378
345
|
})
|
|
@@ -381,15 +348,13 @@ export const sso = (options?: SSOOptions) => {
|
|
|
381
348
|
.optional(),
|
|
382
349
|
samlConfig: z
|
|
383
350
|
.object({
|
|
384
|
-
entryPoint: z
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
cert: z.string({}).
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
description: "The callback URL of the provider",
|
|
392
|
-
}),
|
|
351
|
+
entryPoint: z
|
|
352
|
+
.string({})
|
|
353
|
+
.describe("The entry point of the provider"),
|
|
354
|
+
cert: z.string({}).describe("The certificate of the provider"),
|
|
355
|
+
callbackUrl: z
|
|
356
|
+
.string({})
|
|
357
|
+
.describe("The callback URL of the provider"),
|
|
393
358
|
audience: z.string().optional(),
|
|
394
359
|
idpMetadata: z
|
|
395
360
|
.object({
|
|
@@ -404,18 +369,16 @@ export const sso = (options?: SSOOptions) => {
|
|
|
404
369
|
singleSignOnService: z
|
|
405
370
|
.array(
|
|
406
371
|
z.object({
|
|
407
|
-
Binding: z
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
Location: z
|
|
411
|
-
|
|
412
|
-
|
|
372
|
+
Binding: z
|
|
373
|
+
.string()
|
|
374
|
+
.describe("The binding type for the SSO service"),
|
|
375
|
+
Location: z
|
|
376
|
+
.string()
|
|
377
|
+
.describe("The URL for the SSO service"),
|
|
413
378
|
}),
|
|
414
379
|
)
|
|
415
380
|
.optional()
|
|
416
|
-
.
|
|
417
|
-
description: "Single Sign-On service configuration",
|
|
418
|
-
}),
|
|
381
|
+
.describe("Single Sign-On service configuration"),
|
|
419
382
|
})
|
|
420
383
|
.optional(),
|
|
421
384
|
spMetadata: z.object({
|
|
@@ -437,37 +400,20 @@ export const sso = (options?: SSOOptions) => {
|
|
|
437
400
|
additionalParams: z.record(z.string(), z.any()).optional(),
|
|
438
401
|
mapping: z
|
|
439
402
|
.object({
|
|
440
|
-
id: z.string({}).
|
|
441
|
-
|
|
442
|
-
"Field mapping for user ID (defaults to 'nameID')",
|
|
443
|
-
}),
|
|
444
|
-
email: z.string({}).meta({
|
|
445
|
-
description:
|
|
446
|
-
"Field mapping for email (defaults to 'email')",
|
|
447
|
-
}),
|
|
403
|
+
id: z.string({}).describe("Field mapping for user ID ("),
|
|
404
|
+
email: z.string({}).describe("Field mapping for email ("),
|
|
448
405
|
emailVerified: z
|
|
449
406
|
.string({})
|
|
450
|
-
.
|
|
451
|
-
description: "Field mapping for email verification",
|
|
452
|
-
})
|
|
407
|
+
.describe("Field mapping for email verification")
|
|
453
408
|
.optional(),
|
|
454
|
-
name: z.string({}).
|
|
455
|
-
description:
|
|
456
|
-
"Field mapping for name (defaults to 'displayName')",
|
|
457
|
-
}),
|
|
409
|
+
name: z.string({}).describe("Field mapping for name ("),
|
|
458
410
|
firstName: z
|
|
459
411
|
.string({})
|
|
460
|
-
.
|
|
461
|
-
description:
|
|
462
|
-
"Field mapping for first name (defaults to 'givenName')",
|
|
463
|
-
})
|
|
412
|
+
.describe("Field mapping for first name (")
|
|
464
413
|
.optional(),
|
|
465
414
|
lastName: z
|
|
466
415
|
.string({})
|
|
467
|
-
.
|
|
468
|
-
description:
|
|
469
|
-
"Field mapping for last name (defaults to 'surname')",
|
|
470
|
-
})
|
|
416
|
+
.describe("Field mapping for last name (")
|
|
471
417
|
.optional(),
|
|
472
418
|
extraFields: z.record(z.string(), z.any()).optional(),
|
|
473
419
|
})
|
|
@@ -476,17 +422,15 @@ export const sso = (options?: SSOOptions) => {
|
|
|
476
422
|
.optional(),
|
|
477
423
|
organizationId: z
|
|
478
424
|
.string({})
|
|
479
|
-
.
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
})
|
|
425
|
+
.describe(
|
|
426
|
+
"If organization plugin is enabled, the organization id to link the provider to",
|
|
427
|
+
)
|
|
483
428
|
.optional(),
|
|
484
429
|
overrideUserInfo: z
|
|
485
430
|
.boolean({})
|
|
486
|
-
.
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
})
|
|
431
|
+
.describe(
|
|
432
|
+
"Override user info with the provider info. Defaults to false",
|
|
433
|
+
)
|
|
490
434
|
.default(false)
|
|
491
435
|
.optional(),
|
|
492
436
|
}),
|
|
@@ -801,58 +745,44 @@ export const sso = (options?: SSOOptions) => {
|
|
|
801
745
|
body: z.object({
|
|
802
746
|
email: z
|
|
803
747
|
.string({})
|
|
804
|
-
.
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
})
|
|
748
|
+
.describe(
|
|
749
|
+
"The email address to sign in with. This is used to identify the issuer to sign in with",
|
|
750
|
+
)
|
|
808
751
|
.optional(),
|
|
809
752
|
organizationSlug: z
|
|
810
753
|
.string({})
|
|
811
|
-
.
|
|
812
|
-
description: "The slug of the organization to sign in with",
|
|
813
|
-
})
|
|
754
|
+
.describe("The slug of the organization to sign in with")
|
|
814
755
|
.optional(),
|
|
815
756
|
providerId: z
|
|
816
757
|
.string({})
|
|
817
|
-
.
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
})
|
|
758
|
+
.describe(
|
|
759
|
+
"The ID of the provider to sign in with. This can be provided instead of email or issuer",
|
|
760
|
+
)
|
|
821
761
|
.optional(),
|
|
822
762
|
domain: z
|
|
823
763
|
.string({})
|
|
824
|
-
.
|
|
825
|
-
description: "The domain of the provider.",
|
|
826
|
-
})
|
|
764
|
+
.describe("The domain of the provider.")
|
|
827
765
|
.optional(),
|
|
828
|
-
callbackURL: z
|
|
829
|
-
|
|
830
|
-
|
|
766
|
+
callbackURL: z
|
|
767
|
+
.string({})
|
|
768
|
+
.describe("The URL to redirect to after login"),
|
|
831
769
|
errorCallbackURL: z
|
|
832
770
|
.string({})
|
|
833
|
-
.
|
|
834
|
-
description: "The URL to redirect to after login",
|
|
835
|
-
})
|
|
771
|
+
.describe("The URL to redirect to after login")
|
|
836
772
|
.optional(),
|
|
837
773
|
newUserCallbackURL: z
|
|
838
774
|
.string({})
|
|
839
|
-
.
|
|
840
|
-
description:
|
|
841
|
-
"The URL to redirect to after login if the user is new",
|
|
842
|
-
})
|
|
775
|
+
.describe("The URL to redirect to after login if the user is new")
|
|
843
776
|
.optional(),
|
|
844
777
|
scopes: z
|
|
845
778
|
.array(z.string(), {})
|
|
846
|
-
.
|
|
847
|
-
description: "Scopes to request from the provider.",
|
|
848
|
-
})
|
|
779
|
+
.describe("Scopes to request from the provider.")
|
|
849
780
|
.optional(),
|
|
850
781
|
requestSignUp: z
|
|
851
782
|
.boolean({})
|
|
852
|
-
.
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
})
|
|
783
|
+
.describe(
|
|
784
|
+
"Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider",
|
|
785
|
+
)
|
|
856
786
|
.optional(),
|
|
857
787
|
providerType: z.enum(["oidc", "saml"]).optional(),
|
|
858
788
|
}),
|
package/tsconfig.json
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"resolveJsonModule": true,
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"moduleResolution": "Bundler",
|
|
11
|
-
"moduleDetection": "force",
|
|
12
|
-
"isolatedModules": true,
|
|
13
|
-
"verbatimModuleSyntax": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noImplicitOverride": true,
|
|
16
|
-
"noFallthroughCasesInSwitch": true
|
|
4
|
+
"rootDir": "./src",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"lib": ["esnext", "dom", "dom.iterable"]
|
|
17
7
|
},
|
|
18
|
-
"
|
|
8
|
+
"references": [
|
|
9
|
+
{
|
|
10
|
+
"path": "../better-auth/tsconfig.json"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
19
13
|
"include": ["src"]
|
|
20
14
|
}
|