@better-auth/core 1.4.0-beta.9 → 1.4.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.
Files changed (151) hide show
  1. package/.turbo/turbo-build.log +41 -76
  2. package/dist/api/index.d.mts +3 -0
  3. package/dist/api/index.mjs +26 -0
  4. package/dist/async_hooks/index.d.mts +2 -10
  5. package/dist/async_hooks/index.mjs +2 -24
  6. package/dist/async_hooks-BfRfbd1J.mjs +18 -0
  7. package/dist/context/index.d.mts +54 -0
  8. package/dist/context/index.mjs +4 -0
  9. package/dist/context-DgQ9XGBl.mjs +114 -0
  10. package/dist/db/adapter/index.d.mts +3 -14
  11. package/dist/db/adapter/index.mjs +1 -1
  12. package/dist/db/index.d.mts +3 -39
  13. package/dist/db/index.mjs +46 -55
  14. package/dist/env/index.d.mts +2 -36
  15. package/dist/env/index.mjs +2 -299
  16. package/dist/env-DwlNAN_D.mjs +245 -0
  17. package/dist/error/index.d.mts +31 -29
  18. package/dist/error/index.mjs +3 -40
  19. package/dist/error-BhAKg8LX.mjs +45 -0
  20. package/dist/index-CdubV7uy.d.mts +82 -0
  21. package/dist/index-CkAWdKH8.d.mts +7352 -0
  22. package/dist/index-DgwIISs7.d.mts +7 -0
  23. package/dist/index.d.mts +3 -180
  24. package/dist/index.mjs +1 -1
  25. package/dist/oauth2/index.d.mts +3 -99
  26. package/dist/oauth2/index.mjs +2 -356
  27. package/dist/oauth2-DmgZmPEg.mjs +236 -0
  28. package/dist/social-providers/index.d.mts +3 -3903
  29. package/dist/social-providers/index.mjs +2434 -2654
  30. package/dist/utils/index.d.mts +5 -6
  31. package/dist/utils/index.mjs +2 -4
  32. package/dist/utils-C5EN75oV.mjs +7 -0
  33. package/package.json +70 -111
  34. package/src/api/index.ts +53 -0
  35. package/src/async_hooks/index.ts +1 -9
  36. package/src/context/endpoint-context.ts +49 -0
  37. package/src/context/index.ts +21 -0
  38. package/src/context/request-state.test.ts +94 -0
  39. package/src/context/request-state.ts +90 -0
  40. package/src/context/transaction.ts +73 -0
  41. package/src/db/adapter/index.ts +215 -129
  42. package/src/db/index.ts +12 -13
  43. package/src/db/plugin.ts +3 -3
  44. package/src/db/type.ts +54 -42
  45. package/src/env/color-depth.ts +5 -4
  46. package/src/env/env-impl.ts +2 -1
  47. package/src/env/index.ts +9 -9
  48. package/src/env/logger.test.ts +3 -2
  49. package/src/env/logger.ts +11 -9
  50. package/src/error/codes.ts +1 -1
  51. package/src/error/index.ts +1 -1
  52. package/src/oauth2/client-credentials-token.ts +9 -9
  53. package/src/oauth2/create-authorization-url.ts +12 -12
  54. package/src/oauth2/index.ts +10 -11
  55. package/src/oauth2/oauth-provider.ts +96 -74
  56. package/src/oauth2/refresh-access-token.ts +12 -12
  57. package/src/oauth2/utils.ts +2 -0
  58. package/src/oauth2/validate-authorization-code.ts +13 -15
  59. package/src/social-providers/apple.ts +8 -8
  60. package/src/social-providers/atlassian.ts +21 -19
  61. package/src/social-providers/cognito.ts +15 -15
  62. package/src/social-providers/discord.ts +8 -11
  63. package/src/social-providers/dropbox.ts +5 -5
  64. package/src/social-providers/facebook.ts +12 -10
  65. package/src/social-providers/figma.ts +6 -6
  66. package/src/social-providers/github.ts +4 -4
  67. package/src/social-providers/gitlab.ts +13 -10
  68. package/src/social-providers/google.ts +13 -13
  69. package/src/social-providers/huggingface.ts +27 -25
  70. package/src/social-providers/index.ts +30 -24
  71. package/src/social-providers/kakao.ts +41 -41
  72. package/src/social-providers/kick.ts +7 -9
  73. package/src/social-providers/line.ts +12 -12
  74. package/src/social-providers/linear.ts +9 -8
  75. package/src/social-providers/linkedin.ts +5 -5
  76. package/src/social-providers/microsoft-entra-id.ts +31 -15
  77. package/src/social-providers/naver.ts +5 -5
  78. package/src/social-providers/notion.ts +11 -9
  79. package/src/social-providers/paybin.ts +122 -0
  80. package/src/social-providers/paypal.ts +31 -29
  81. package/src/social-providers/polar.ts +110 -0
  82. package/src/social-providers/reddit.ts +6 -6
  83. package/src/social-providers/roblox.ts +15 -14
  84. package/src/social-providers/salesforce.ts +20 -18
  85. package/src/social-providers/slack.ts +4 -7
  86. package/src/social-providers/spotify.ts +5 -5
  87. package/src/social-providers/tiktok.ts +32 -33
  88. package/src/social-providers/twitch.ts +8 -8
  89. package/src/social-providers/twitter.ts +49 -45
  90. package/src/social-providers/vk.ts +14 -17
  91. package/src/social-providers/zoom.ts +29 -14
  92. package/src/types/context.ts +67 -67
  93. package/src/types/cookie.ts +1 -0
  94. package/src/types/index.ts +13 -11
  95. package/src/types/init-options.ts +1134 -911
  96. package/src/types/plugin-client.ts +61 -13
  97. package/src/types/plugin.ts +81 -57
  98. package/tsconfig.json +2 -5
  99. package/{build.config.ts → tsdown.config.ts} +8 -11
  100. package/vitest.config.ts +3 -0
  101. package/dist/async_hooks/index.cjs +0 -27
  102. package/dist/async_hooks/index.d.cts +0 -10
  103. package/dist/async_hooks/index.d.ts +0 -10
  104. package/dist/db/adapter/index.cjs +0 -2
  105. package/dist/db/adapter/index.d.cts +0 -14
  106. package/dist/db/adapter/index.d.ts +0 -14
  107. package/dist/db/index.cjs +0 -91
  108. package/dist/db/index.d.cts +0 -39
  109. package/dist/db/index.d.ts +0 -39
  110. package/dist/env/index.cjs +0 -315
  111. package/dist/env/index.d.cts +0 -36
  112. package/dist/env/index.d.ts +0 -36
  113. package/dist/error/index.cjs +0 -44
  114. package/dist/error/index.d.cts +0 -33
  115. package/dist/error/index.d.ts +0 -33
  116. package/dist/index.cjs +0 -2
  117. package/dist/index.d.cts +0 -180
  118. package/dist/index.d.ts +0 -180
  119. package/dist/middleware/index.cjs +0 -25
  120. package/dist/middleware/index.d.cts +0 -14
  121. package/dist/middleware/index.d.mts +0 -14
  122. package/dist/middleware/index.d.ts +0 -14
  123. package/dist/middleware/index.mjs +0 -21
  124. package/dist/oauth2/index.cjs +0 -368
  125. package/dist/oauth2/index.d.cts +0 -99
  126. package/dist/oauth2/index.d.ts +0 -99
  127. package/dist/shared/core.2rWMW9q9.d.ts +0 -13
  128. package/dist/shared/core.40VTWh-p.d.cts +0 -217
  129. package/dist/shared/core.BfcVdsSf.d.cts +0 -181
  130. package/dist/shared/core.Bisb2Bdk.d.mts +0 -181
  131. package/dist/shared/core.BwoNUcJQ.d.cts +0 -53
  132. package/dist/shared/core.BwoNUcJQ.d.mts +0 -53
  133. package/dist/shared/core.BwoNUcJQ.d.ts +0 -53
  134. package/dist/shared/core.CErFRCOZ.d.mts +0 -1684
  135. package/dist/shared/core.CGN6D-Mh.d.ts +0 -181
  136. package/dist/shared/core.CPuIItYE.d.ts +0 -217
  137. package/dist/shared/core.CftpHMDz.d.cts +0 -13
  138. package/dist/shared/core.Db7zJyxf.d.ts +0 -1684
  139. package/dist/shared/core.DqaxObkf.d.cts +0 -1684
  140. package/dist/shared/core.MjcDoj7R.d.cts +0 -5
  141. package/dist/shared/core.MjcDoj7R.d.mts +0 -5
  142. package/dist/shared/core.MjcDoj7R.d.ts +0 -5
  143. package/dist/shared/core.g2ZbxAEV.d.mts +0 -217
  144. package/dist/shared/core.g9ACQ8v2.d.mts +0 -13
  145. package/dist/social-providers/index.cjs +0 -2793
  146. package/dist/social-providers/index.d.cts +0 -3903
  147. package/dist/social-providers/index.d.ts +0 -3903
  148. package/dist/utils/index.cjs +0 -7
  149. package/dist/utils/index.d.cts +0 -10
  150. package/dist/utils/index.d.ts +0 -10
  151. package/src/middleware/index.ts +0 -33
@@ -1,11 +1,11 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
2
+ import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
3
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
4
  import {
4
5
  createAuthorizationURL,
6
+ refreshAccessToken,
5
7
  validateAuthorizationCode,
6
- } from "@better-auth/core/oauth2";
7
- import { createRemoteJWKSet, jwtVerify, decodeJwt } from "jose";
8
- import { refreshAccessToken } from "@better-auth/core/oauth2";
8
+ } from "../oauth2";
9
9
  export interface FacebookProfile {
10
10
  id: string;
11
11
  name: string;
@@ -28,12 +28,12 @@ export interface FacebookOptions extends ProviderOptions<FacebookProfile> {
28
28
  *
29
29
  * @default ["id", "name", "email", "picture"]
30
30
  */
31
- fields?: string[];
31
+ fields?: string[] | undefined;
32
32
 
33
33
  /**
34
34
  * The config id to use when undergoing oauth
35
35
  */
36
- configId?: string;
36
+ configId?: string | undefined;
37
37
  }
38
38
 
39
39
  export const facebook = (options: FacebookOptions) => {
@@ -44,8 +44,8 @@ export const facebook = (options: FacebookOptions) => {
44
44
  const _scopes = options.disableDefaultScope
45
45
  ? []
46
46
  : ["email", "public_profile"];
47
- options.scope && _scopes.push(...options.scope);
48
- scopes && _scopes.push(...scopes);
47
+ if (options.scope) _scopes.push(...options.scope);
48
+ if (scopes) _scopes.push(...scopes);
49
49
  return await createAuthorizationURL({
50
50
  id: "facebook",
51
51
  options,
@@ -152,15 +152,17 @@ export const facebook = (options: FacebookOptions) => {
152
152
  };
153
153
 
154
154
  // https://developers.facebook.com/docs/facebook-login/limited-login/permissions
155
+ // Facebook ID token does not include email_verified claim.
156
+ // We default to false for security consistency.
155
157
  const userMap = await options.mapProfileToUser?.({
156
158
  ...user,
157
- email_verified: true,
159
+ email_verified: false,
158
160
  });
159
161
 
160
162
  return {
161
163
  user: {
162
164
  ...user,
163
- emailVerified: true,
165
+ emailVerified: false,
164
166
  ...userMap,
165
167
  },
166
168
  data: profile,
@@ -1,12 +1,12 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
+ import { logger } from "../env";
2
3
  import { BetterAuthError } from "../error";
3
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
4
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
4
5
  import {
5
6
  createAuthorizationURL,
7
+ refreshAccessToken,
6
8
  validateAuthorizationCode,
7
- } from "@better-auth/core/oauth2";
8
- import { logger } from "@better-auth/core/env";
9
- import { refreshAccessToken } from "@better-auth/core/oauth2";
9
+ } from "../oauth2";
10
10
 
11
11
  export interface FigmaProfile {
12
12
  id: string;
@@ -35,8 +35,8 @@ export const figma = (options: FigmaOptions) => {
35
35
  }
36
36
 
37
37
  const _scopes = options.disableDefaultScope ? [] : ["file_read"];
38
- options.scope && _scopes.push(...options.scope);
39
- scopes && _scopes.push(...scopes);
38
+ if (options.scope) _scopes.push(...options.scope);
39
+ if (scopes) _scopes.push(...scopes);
40
40
 
41
41
  const url = await createAuthorizationURL({
42
42
  id: "figma",
@@ -1,10 +1,10 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
2
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
3
  import {
4
4
  createAuthorizationURL,
5
5
  refreshAccessToken,
6
6
  validateAuthorizationCode,
7
- } from "@better-auth/core/oauth2";
7
+ } from "../oauth2";
8
8
 
9
9
  export interface GithubProfile {
10
10
  login: string;
@@ -65,8 +65,8 @@ export const github = (options: GithubOptions) => {
65
65
  const _scopes = options.disableDefaultScope
66
66
  ? []
67
67
  : ["read:user", "user:email"];
68
- options.scope && _scopes.push(...options.scope);
69
- scopes && _scopes.push(...scopes);
68
+ if (options.scope) _scopes.push(...options.scope);
69
+ if (scopes) _scopes.push(...scopes);
70
70
  return createAuthorizationURL({
71
71
  id: "github",
72
72
  options,
@@ -1,10 +1,10 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
2
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
3
  import {
4
4
  createAuthorizationURL,
5
- validateAuthorizationCode,
6
5
  refreshAccessToken,
7
- } from "@better-auth/core/oauth2";
6
+ validateAuthorizationCode,
7
+ } from "../oauth2";
8
8
 
9
9
  export interface GitlabProfile extends Record<string, any> {
10
10
  id: number;
@@ -16,7 +16,7 @@ export interface GitlabProfile extends Record<string, any> {
16
16
  web_url: string;
17
17
  created_at: string;
18
18
  bio: string;
19
- location?: string;
19
+ location?: string | undefined;
20
20
  public_email: string;
21
21
  skype: string;
22
22
  linkedin: string;
@@ -26,7 +26,7 @@ export interface GitlabProfile extends Record<string, any> {
26
26
  job_title: string;
27
27
  pronouns: string;
28
28
  bot: boolean;
29
- work_information?: string;
29
+ work_information?: string | undefined;
30
30
  followers: number;
31
31
  following: number;
32
32
  local_time: string;
@@ -49,11 +49,12 @@ export interface GitlabProfile extends Record<string, any> {
49
49
  commit_email: string;
50
50
  shared_runners_minutes_limit: number;
51
51
  extra_shared_runners_minutes_limit: number;
52
+ email_verified?: boolean | undefined;
52
53
  }
53
54
 
54
55
  export interface GitlabOptions extends ProviderOptions<GitlabProfile> {
55
56
  clientId: string;
56
- issuer?: string;
57
+ issuer?: string | undefined;
57
58
  }
58
59
 
59
60
  const cleanDoubleSlashes = (input: string = "") => {
@@ -63,7 +64,7 @@ const cleanDoubleSlashes = (input: string = "") => {
63
64
  .join("://");
64
65
  };
65
66
 
66
- const issuerToEndpoints = (issuer?: string) => {
67
+ const issuerToEndpoints = (issuer?: string | undefined) => {
67
68
  let baseUrl = issuer || "https://gitlab.com";
68
69
  return {
69
70
  authorizationEndpoint: cleanDoubleSlashes(`${baseUrl}/oauth/authorize`),
@@ -88,8 +89,8 @@ export const gitlab = (options: GitlabOptions) => {
88
89
  redirectURI,
89
90
  }) => {
90
91
  const _scopes = options.disableDefaultScope ? [] : ["read_user"];
91
- options.scope && _scopes.push(...options.scope);
92
- scopes && _scopes.push(...scopes);
92
+ if (options.scope) _scopes.push(...options.scope);
93
+ if (scopes) _scopes.push(...scopes);
93
94
  return await createAuthorizationURL({
94
95
  id: issuerId,
95
96
  options,
@@ -135,13 +136,15 @@ export const gitlab = (options: GitlabOptions) => {
135
136
  return null;
136
137
  }
137
138
  const userMap = await options.mapProfileToUser?.(profile);
139
+ // GitLab may provide email_verified claim, but it's not guaranteed.
140
+ // We check for it first, then default to false for security consistency.
138
141
  return {
139
142
  user: {
140
143
  id: profile.id,
141
144
  name: profile.name ?? profile.username,
142
145
  email: profile.email,
143
146
  image: profile.avatar_url,
144
- emailVerified: true,
147
+ emailVerified: profile.email_verified ?? false,
145
148
  ...userMap,
146
149
  },
147
150
  data: profile,
@@ -1,13 +1,13 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
2
  import { decodeJwt } from "jose";
3
+ import { logger } from "../env";
3
4
  import { BetterAuthError } from "../error";
4
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
5
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
5
6
  import {
6
7
  createAuthorizationURL,
8
+ refreshAccessToken,
7
9
  validateAuthorizationCode,
8
- } from "@better-auth/core/oauth2";
9
- import { logger } from "@better-auth/core/env";
10
- import { refreshAccessToken } from "@better-auth/core/oauth2";
10
+ } from "../oauth2";
11
11
 
12
12
  export interface GoogleProfile {
13
13
  aud: string;
@@ -25,13 +25,13 @@ export interface GoogleProfile {
25
25
  * Western languages.
26
26
  */
27
27
  given_name: string;
28
- hd?: string;
28
+ hd?: string | undefined;
29
29
  iat: number;
30
30
  iss: string;
31
- jti?: string;
32
- locale?: string;
31
+ jti?: string | undefined;
32
+ locale?: string | undefined;
33
33
  name: string;
34
- nbf?: number;
34
+ nbf?: number | undefined;
35
35
  picture: string;
36
36
  sub: string;
37
37
  }
@@ -41,15 +41,15 @@ export interface GoogleOptions extends ProviderOptions<GoogleProfile> {
41
41
  /**
42
42
  * The access type to use for the authorization code request
43
43
  */
44
- accessType?: "offline" | "online";
44
+ accessType?: ("offline" | "online") | undefined;
45
45
  /**
46
46
  * The display mode to use for the authorization code request
47
47
  */
48
- display?: "page" | "popup" | "touch" | "wap";
48
+ display?: ("page" | "popup" | "touch" | "wap") | undefined;
49
49
  /**
50
50
  * The hosted domain of the user
51
51
  */
52
- hd?: string;
52
+ hd?: string | undefined;
53
53
  }
54
54
 
55
55
  export const google = (options: GoogleOptions) => {
@@ -76,8 +76,8 @@ export const google = (options: GoogleOptions) => {
76
76
  const _scopes = options.disableDefaultScope
77
77
  ? []
78
78
  : ["email", "profile", "openid"];
79
- options.scope && _scopes.push(...options.scope);
80
- scopes && _scopes.push(...scopes);
79
+ if (options.scope) _scopes.push(...options.scope);
80
+ if (scopes) _scopes.push(...scopes);
81
81
  const url = await createAuthorizationURL({
82
82
  id: "google",
83
83
  options,
@@ -1,10 +1,10 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
2
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
3
  import {
4
4
  createAuthorizationURL,
5
- validateAuthorizationCode,
6
5
  refreshAccessToken,
7
- } from "@better-auth/core/oauth2";
6
+ validateAuthorizationCode,
7
+ } from "../oauth2";
8
8
 
9
9
  export interface HuggingFaceProfile {
10
10
  sub: string;
@@ -12,27 +12,29 @@ export interface HuggingFaceProfile {
12
12
  preferred_username: string;
13
13
  profile: string;
14
14
  picture: string;
15
- website?: string;
16
- email?: string;
17
- email_verified?: boolean;
15
+ website?: string | undefined;
16
+ email?: string | undefined;
17
+ email_verified?: boolean | undefined;
18
18
  isPro: boolean;
19
- canPay?: boolean;
20
- orgs?: {
21
- sub: string;
22
- name: string;
23
- picture: string;
24
- preferred_username: string;
25
- isEnterprise: boolean | "plus";
26
- canPay?: boolean;
27
- roleInOrg?: "admin" | "write" | "contributor" | "read";
28
- pendingSSO?: boolean;
29
- missingMFA?: boolean;
30
- resourceGroups?: {
31
- sub: string;
32
- name: string;
33
- role: "admin" | "write" | "contributor" | "read";
34
- }[];
35
- };
19
+ canPay?: boolean | undefined;
20
+ orgs?:
21
+ | {
22
+ sub: string;
23
+ name: string;
24
+ picture: string;
25
+ preferred_username: string;
26
+ isEnterprise: boolean | "plus";
27
+ canPay?: boolean;
28
+ roleInOrg?: "admin" | "write" | "contributor" | "read";
29
+ pendingSSO?: boolean;
30
+ missingMFA?: boolean;
31
+ resourceGroups?: {
32
+ sub: string;
33
+ name: string;
34
+ role: "admin" | "write" | "contributor" | "read";
35
+ }[];
36
+ }
37
+ | undefined;
36
38
  }
37
39
 
38
40
  export interface HuggingFaceOptions
@@ -48,8 +50,8 @@ export const huggingface = (options: HuggingFaceOptions) => {
48
50
  const _scopes = options.disableDefaultScope
49
51
  ? []
50
52
  : ["openid", "profile", "email"];
51
- options.scope && _scopes.push(...options.scope);
52
- scopes && _scopes.push(...scopes);
53
+ if (options.scope) _scopes.push(...options.scope);
54
+ if (scopes) _scopes.push(...scopes);
53
55
  return createAuthorizationURL({
54
56
  id: "huggingface",
55
57
  options,
@@ -3,32 +3,34 @@ import { apple } from "./apple";
3
3
  import { atlassian } from "./atlassian";
4
4
  import { cognito } from "./cognito";
5
5
  import { discord } from "./discord";
6
+ import { dropbox } from "./dropbox";
6
7
  import { facebook } from "./facebook";
7
8
  import { figma } from "./figma";
8
9
  import { github } from "./github";
10
+ import { gitlab } from "./gitlab";
9
11
  import { google } from "./google";
10
- import { kick } from "./kick";
11
12
  import { huggingface } from "./huggingface";
12
- import { microsoft } from "./microsoft-entra-id";
13
- import { slack } from "./slack";
14
- import { notion } from "./notion";
15
- import { spotify } from "./spotify";
16
- import { twitch } from "./twitch";
17
- import { twitter } from "./twitter";
18
- import { dropbox } from "./dropbox";
13
+ import { kakao } from "./kakao";
14
+ import { kick } from "./kick";
15
+ import { line } from "./line";
19
16
  import { linear } from "./linear";
20
17
  import { linkedin } from "./linkedin";
21
- import { gitlab } from "./gitlab";
22
- import { tiktok } from "./tiktok";
18
+ import { microsoft } from "./microsoft-entra-id";
19
+ import { naver } from "./naver";
20
+ import { notion } from "./notion";
21
+ import { paybin } from "./paybin";
22
+ import { paypal } from "./paypal";
23
+ import { polar } from "./polar";
23
24
  import { reddit } from "./reddit";
24
25
  import { roblox } from "./roblox";
25
26
  import { salesforce } from "./salesforce";
27
+ import { slack } from "./slack";
28
+ import { spotify } from "./spotify";
29
+ import { tiktok } from "./tiktok";
30
+ import { twitch } from "./twitch";
31
+ import { twitter } from "./twitter";
26
32
  import { vk } from "./vk";
27
33
  import { zoom } from "./zoom";
28
- import { kakao } from "./kakao";
29
- import { naver } from "./naver";
30
- import { line } from "./line";
31
- import { paypal } from "./paypal";
32
34
 
33
35
  export const socialProviders = {
34
36
  apple,
@@ -60,7 +62,9 @@ export const socialProviders = {
60
62
  kakao,
61
63
  naver,
62
64
  line,
65
+ paybin,
63
66
  paypal,
67
+ polar,
64
68
  };
65
69
 
66
70
  export const socialProviderList = Object.keys(socialProviders) as [
@@ -78,7 +82,7 @@ export type SocialProviders = {
78
82
  [K in SocialProviderList[number]]?: Parameters<
79
83
  (typeof socialProviders)[K]
80
84
  >[0] & {
81
- enabled?: boolean;
85
+ enabled?: boolean | undefined;
82
86
  };
83
87
  };
84
88
 
@@ -90,29 +94,31 @@ export * from "./dropbox";
90
94
  export * from "./facebook";
91
95
  export * from "./figma";
92
96
  export * from "./github";
93
- export * from "./linear";
94
- export * from "./linkedin";
95
97
  export * from "./gitlab";
96
98
  export * from "./google";
99
+ export * from "./huggingface";
100
+ export * from "./kakao";
97
101
  export * from "./kick";
102
+ export * from "./kick";
103
+ export * from "./line";
104
+ export * from "./linear";
105
+ export * from "./linkedin";
98
106
  export * from "./linkedin";
99
107
  export * from "./microsoft-entra-id";
108
+ export * from "./naver";
100
109
  export * from "./notion";
110
+ export * from "./paybin";
111
+ export * from "./paypal";
112
+ export * from "./polar";
101
113
  export * from "./reddit";
102
114
  export * from "./roblox";
103
115
  export * from "./salesforce";
116
+ export * from "./slack";
104
117
  export * from "./spotify";
105
118
  export * from "./tiktok";
106
119
  export * from "./twitch";
107
120
  export * from "./twitter";
108
121
  export * from "./vk";
109
122
  export * from "./zoom";
110
- export * from "./kick";
111
- export * from "./huggingface";
112
- export * from "./slack";
113
- export * from "./kakao";
114
- export * from "./naver";
115
- export * from "./line";
116
- export * from "./paypal";
117
123
 
118
124
  export type SocialProviderList = typeof socialProviderList;
@@ -1,80 +1,80 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
2
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
3
  import {
4
4
  createAuthorizationURL,
5
- validateAuthorizationCode,
6
5
  refreshAccessToken,
7
- } from "@better-auth/core/oauth2";
6
+ validateAuthorizationCode,
7
+ } from "../oauth2";
8
8
 
9
9
  interface Partner {
10
10
  /** Partner-specific ID (consent required: kakaotalk_message) */
11
- uuid?: string;
11
+ uuid?: string | undefined;
12
12
  }
13
13
 
14
14
  interface Profile {
15
15
  /** Nickname (consent required: profile/nickname) */
16
- nickname?: string;
16
+ nickname?: string | undefined;
17
17
  /** Thumbnail image URL (consent required: profile/profile image) */
18
- thumbnail_image_url?: string;
18
+ thumbnail_image_url?: string | undefined;
19
19
  /** Profile image URL (consent required: profile/profile image) */
20
- profile_image_url?: string;
20
+ profile_image_url?: string | undefined;
21
21
  /** Whether the profile image is the default */
22
- is_default_image?: boolean;
22
+ is_default_image?: boolean | undefined;
23
23
  /** Whether the nickname is the default */
24
- is_default_nickname?: boolean;
24
+ is_default_nickname?: boolean | undefined;
25
25
  }
26
26
 
27
27
  interface KakaoAccount {
28
28
  /** Consent required: profile info (nickname/profile image) */
29
- profile_needs_agreement?: boolean;
29
+ profile_needs_agreement?: boolean | undefined;
30
30
  /** Consent required: nickname */
31
- profile_nickname_needs_agreement?: boolean;
31
+ profile_nickname_needs_agreement?: boolean | undefined;
32
32
  /** Consent required: profile image */
33
- profile_image_needs_agreement?: boolean;
33
+ profile_image_needs_agreement?: boolean | undefined;
34
34
  /** Profile info */
35
- profile?: Profile;
35
+ profile?: Profile | undefined;
36
36
  /** Consent required: name */
37
- name_needs_agreement?: boolean;
37
+ name_needs_agreement?: boolean | undefined;
38
38
  /** Name */
39
- name?: string;
39
+ name?: string | undefined;
40
40
  /** Consent required: email */
41
- email_needs_agreement?: boolean;
41
+ email_needs_agreement?: boolean | undefined;
42
42
  /** Email valid */
43
- is_email_valid?: boolean;
43
+ is_email_valid?: boolean | undefined;
44
44
  /** Email verified */
45
- is_email_verified?: boolean;
45
+ is_email_verified?: boolean | undefined;
46
46
  /** Email */
47
- email?: string;
47
+ email?: string | undefined;
48
48
  /** Consent required: age range */
49
- age_range_needs_agreement?: boolean;
49
+ age_range_needs_agreement?: boolean | undefined;
50
50
  /** Age range */
51
- age_range?: string;
51
+ age_range?: string | undefined;
52
52
  /** Consent required: birth year */
53
- birthyear_needs_agreement?: boolean;
53
+ birthyear_needs_agreement?: boolean | undefined;
54
54
  /** Birth year (YYYY) */
55
- birthyear?: string;
55
+ birthyear?: string | undefined;
56
56
  /** Consent required: birthday */
57
- birthday_needs_agreement?: boolean;
57
+ birthday_needs_agreement?: boolean | undefined;
58
58
  /** Birthday (MMDD) */
59
- birthday?: string;
59
+ birthday?: string | undefined;
60
60
  /** Birthday type (SOLAR/LUNAR) */
61
- birthday_type?: string;
61
+ birthday_type?: string | undefined;
62
62
  /** Whether birthday is in a leap month */
63
- is_leap_month?: boolean;
63
+ is_leap_month?: boolean | undefined;
64
64
  /** Consent required: gender */
65
- gender_needs_agreement?: boolean;
65
+ gender_needs_agreement?: boolean | undefined;
66
66
  /** Gender (male/female) */
67
- gender?: string;
67
+ gender?: string | undefined;
68
68
  /** Consent required: phone number */
69
- phone_number_needs_agreement?: boolean;
69
+ phone_number_needs_agreement?: boolean | undefined;
70
70
  /** Phone number */
71
- phone_number?: string;
71
+ phone_number?: string | undefined;
72
72
  /** Consent required: CI */
73
- ci_needs_agreement?: boolean;
73
+ ci_needs_agreement?: boolean | undefined;
74
74
  /** CI (unique identifier) */
75
- ci?: string;
75
+ ci?: string | undefined;
76
76
  /** CI authentication time (UTC) */
77
- ci_authenticated_at?: string;
77
+ ci_authenticated_at?: string | undefined;
78
78
  }
79
79
 
80
80
  export interface KakaoProfile {
@@ -84,17 +84,17 @@ export interface KakaoProfile {
84
84
  * Whether the user has signed up (only present if auto-connection is disabled)
85
85
  * false: preregistered, true: registered
86
86
  */
87
- has_signed_up?: boolean;
87
+ has_signed_up?: boolean | undefined;
88
88
  /** UTC datetime when the user connected the service */
89
- connected_at?: string;
89
+ connected_at?: string | undefined;
90
90
  /** UTC datetime when the user signed up via Kakao Sync */
91
- synched_at?: string;
91
+ synched_at?: string | undefined;
92
92
  /** Custom user properties */
93
- properties?: Record<string, any>;
93
+ properties?: Record<string, any> | undefined;
94
94
  /** Kakao account info */
95
95
  kakao_account: KakaoAccount;
96
96
  /** Partner info */
97
- for_partner?: Partner;
97
+ for_partner?: Partner | undefined;
98
98
  }
99
99
 
100
100
  export interface KakaoOptions extends ProviderOptions<KakaoProfile> {
@@ -109,8 +109,8 @@ export const kakao = (options: KakaoOptions) => {
109
109
  const _scopes = options.disableDefaultScope
110
110
  ? []
111
111
  : ["account_email", "profile_image", "profile_nickname"];
112
- options.scope && _scopes.push(...options.scope);
113
- scopes && _scopes.push(...scopes);
112
+ if (options.scope) _scopes.push(...options.scope);
113
+ if (scopes) _scopes.push(...scopes);
114
114
  return createAuthorizationURL({
115
115
  id: "kakao",
116
116
  options,
@@ -1,9 +1,6 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import {
3
- createAuthorizationURL,
4
- validateAuthorizationCode,
5
- } from "@better-auth/core/oauth2";
6
- import type { OAuthProvider, ProviderOptions } from "@better-auth/core/oauth2";
2
+ import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
+ import { createAuthorizationURL, validateAuthorizationCode } from "../oauth2";
7
4
 
8
5
  export interface KickProfile {
9
6
  /**
@@ -34,8 +31,8 @@ export const kick = (options: KickOptions) => {
34
31
  name: "Kick",
35
32
  createAuthorizationURL({ state, scopes, redirectURI, codeVerifier }) {
36
33
  const _scopes = options.disableDefaultScope ? [] : ["user:read"];
37
- options.scope && _scopes.push(...options.scope);
38
- scopes && _scopes.push(...scopes);
34
+ if (options.scope) _scopes.push(...options.scope);
35
+ if (scopes) _scopes.push(...scopes);
39
36
 
40
37
  return createAuthorizationURL({
41
38
  id: "kick",
@@ -77,14 +74,15 @@ export const kick = (options: KickOptions) => {
77
74
  const profile = data.data[0]!;
78
75
 
79
76
  const userMap = await options.mapProfileToUser?.(profile);
80
-
77
+ // Kick does not provide email_verified claim.
78
+ // We default to false for security consistency.
81
79
  return {
82
80
  user: {
83
81
  id: profile.user_id,
84
82
  name: profile.name,
85
83
  email: profile.email,
86
84
  image: profile.profile_picture,
87
- emailVerified: true,
85
+ emailVerified: false,
88
86
  ...userMap,
89
87
  },
90
88
  data: profile,