@better-auth/core 1.7.0-rc.0 → 1.7.0-rc.2
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/api/index.d.mts +28 -28
- package/dist/async_hooks/index.d.mts +0 -1
- package/dist/async_hooks/pure.index.d.mts +0 -1
- package/dist/context/endpoint-context.d.mts +1 -1
- package/dist/context/global.d.mts +0 -1
- package/dist/context/global.mjs +1 -1
- package/dist/context/request-state.d.mts +0 -1
- package/dist/context/request-state.mjs +8 -5
- package/dist/context/transaction.d.mts +8 -3
- package/dist/context/transaction.mjs +27 -10
- package/dist/db/adapter/factory.d.mts +3 -5
- package/dist/db/adapter/factory.mjs +7 -5
- package/dist/db/adapter/get-default-field-name.d.mts +2 -9
- package/dist/db/adapter/get-default-model-name.d.mts +1 -5
- package/dist/db/adapter/get-default-model-name.mjs +6 -5
- package/dist/db/adapter/get-field-attributes.d.mts +4 -11
- package/dist/db/adapter/get-field-name.d.mts +2 -9
- package/dist/db/adapter/get-id-field.d.mts +4 -12
- package/dist/db/adapter/get-model-name.d.mts +1 -5
- package/dist/db/adapter/index.d.mts +7 -32
- package/dist/db/adapter/types.d.mts +5 -17
- package/dist/db/adapter/utils.d.mts +0 -1
- package/dist/db/database-index.d.mts +44 -0
- package/dist/db/database-index.mjs +168 -0
- package/dist/db/get-tables.d.mts +7 -1
- package/dist/db/get-tables.mjs +47 -6
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +2 -2
- package/dist/db/internal.d.mts +3 -0
- package/dist/db/internal.mjs +3 -0
- package/dist/db/plugin.d.mts +4 -3
- package/dist/db/schema/account.d.mts +16 -3
- package/dist/db/schema/account.mjs +35 -2
- package/dist/db/schema/rate-limit.d.mts +1 -1
- package/dist/db/schema/rate-limit.mjs +9 -0
- package/dist/db/schema/session.d.mts +1 -1
- package/dist/db/schema/shared.d.mts +0 -1
- package/dist/db/schema/user.d.mts +1 -1
- package/dist/db/schema/verification.d.mts +1 -1
- package/dist/db/type.d.mts +17 -9
- package/dist/env/logger.d.mts +25 -25
- package/dist/error/codes.d.mts +0 -1
- package/dist/error/index.d.mts +0 -1
- package/dist/index.d.mts +1 -1
- package/dist/instrumentation/attributes.d.mts +0 -1
- package/dist/instrumentation/pure.index.d.mts +0 -1
- package/dist/instrumentation/tracer.mjs +1 -1
- package/dist/oauth2/authorization-params.d.mts +0 -1
- package/dist/oauth2/client-assertion.d.mts +3 -13
- package/dist/oauth2/client-credentials-token.d.mts +3 -17
- package/dist/oauth2/client-credentials-token.mjs +1 -4
- package/dist/oauth2/create-authorization-url.d.mts +3 -21
- package/dist/oauth2/dpop.d.mts +2 -23
- package/dist/oauth2/dpop.mjs +1 -1
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/oauth-provider.d.mts +85 -36
- package/dist/oauth2/refresh-access-token.d.mts +3 -19
- package/dist/oauth2/refresh-access-token.mjs +3 -9
- package/dist/oauth2/reject-redirects.mjs +1 -1
- package/dist/oauth2/token-endpoint-auth.d.mts +0 -1
- package/dist/oauth2/utils.d.mts +0 -1
- package/dist/oauth2/utils.mjs +2 -3
- package/dist/oauth2/validate-authorization-code.d.mts +5 -29
- package/dist/oauth2/verify-id-token.d.mts +3 -2
- package/dist/oauth2/verify-id-token.mjs +3 -3
- package/dist/oauth2/verify.d.mts +5 -7
- package/dist/oauth2/verify.mjs +2 -2
- package/dist/social-providers/apple.d.mts +9 -24
- package/dist/social-providers/apple.mjs +2 -1
- package/dist/social-providers/atlassian.d.mts +18 -19
- package/dist/social-providers/atlassian.mjs +1 -1
- package/dist/social-providers/cognito.d.mts +33 -22
- package/dist/social-providers/cognito.mjs +2 -2
- package/dist/social-providers/discord.d.mts +7 -20
- package/dist/social-providers/discord.mjs +1 -1
- package/dist/social-providers/dropbox.d.mts +7 -22
- package/dist/social-providers/dropbox.mjs +1 -1
- package/dist/social-providers/facebook.d.mts +19 -27
- package/dist/social-providers/facebook.mjs +6 -17
- package/dist/social-providers/figma.d.mts +7 -22
- package/dist/social-providers/figma.mjs +1 -1
- package/dist/social-providers/github.d.mts +7 -23
- package/dist/social-providers/github.mjs +1 -1
- package/dist/social-providers/gitlab.d.mts +6 -43
- package/dist/social-providers/gitlab.mjs +1 -1
- package/dist/social-providers/google.d.mts +10 -32
- package/dist/social-providers/google.mjs +2 -1
- package/dist/social-providers/huggingface.d.mts +7 -22
- package/dist/social-providers/huggingface.mjs +1 -1
- package/dist/social-providers/index.d.mts +229 -787
- package/dist/social-providers/kakao.d.mts +8 -33
- package/dist/social-providers/kakao.mjs +1 -1
- package/dist/social-providers/kick.d.mts +7 -22
- package/dist/social-providers/kick.mjs +1 -1
- package/dist/social-providers/line.d.mts +8 -44
- package/dist/social-providers/line.mjs +4 -6
- package/dist/social-providers/linear.d.mts +7 -21
- package/dist/social-providers/linear.mjs +1 -1
- package/dist/social-providers/linkedin.d.mts +7 -21
- package/dist/social-providers/linkedin.mjs +1 -1
- package/dist/social-providers/microsoft-entra-id.d.mts +8 -18
- package/dist/social-providers/microsoft-entra-id.mjs +18 -2
- package/dist/social-providers/naver.d.mts +27 -42
- package/dist/social-providers/naver.mjs +1 -1
- package/dist/social-providers/notion.d.mts +7 -21
- package/dist/social-providers/notion.mjs +1 -1
- package/dist/social-providers/paybin.d.mts +8 -23
- package/dist/social-providers/paybin.mjs +2 -1
- package/dist/social-providers/paypal.d.mts +8 -33
- package/dist/social-providers/paypal.mjs +1 -1
- package/dist/social-providers/polar.d.mts +7 -22
- package/dist/social-providers/polar.mjs +1 -1
- package/dist/social-providers/railway.d.mts +7 -22
- package/dist/social-providers/railway.mjs +1 -1
- package/dist/social-providers/reddit.d.mts +7 -20
- package/dist/social-providers/reddit.mjs +1 -1
- package/dist/social-providers/roblox.d.mts +7 -20
- package/dist/social-providers/roblox.mjs +1 -1
- package/dist/social-providers/salesforce.d.mts +7 -22
- package/dist/social-providers/salesforce.mjs +1 -1
- package/dist/social-providers/slack.d.mts +7 -20
- package/dist/social-providers/slack.mjs +1 -1
- package/dist/social-providers/spotify.d.mts +7 -22
- package/dist/social-providers/spotify.mjs +1 -1
- package/dist/social-providers/tiktok.d.mts +10 -22
- package/dist/social-providers/tiktok.mjs +1 -1
- package/dist/social-providers/twitch.d.mts +7 -20
- package/dist/social-providers/twitch.mjs +1 -1
- package/dist/social-providers/twitter.d.mts +29 -26
- package/dist/social-providers/twitter.mjs +1 -1
- package/dist/social-providers/vercel.d.mts +7 -22
- package/dist/social-providers/vercel.mjs +1 -1
- package/dist/social-providers/vk.d.mts +8 -24
- package/dist/social-providers/vk.mjs +5 -6
- package/dist/social-providers/wechat.d.mts +7 -19
- package/dist/social-providers/wechat.mjs +1 -1
- package/dist/social-providers/zoom.d.mts +9 -25
- package/dist/social-providers/zoom.mjs +1 -1
- package/dist/types/context.d.mts +16 -9
- package/dist/types/cookie.d.mts +0 -1
- package/dist/types/helper.d.mts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/init-options.d.mts +37 -26
- package/dist/types/plugin-client.d.mts +1 -3
- package/dist/types/plugin.d.mts +2 -2
- package/dist/utils/async.d.mts +0 -1
- package/dist/utils/db.d.mts +1 -0
- package/dist/utils/deprecate.d.mts +0 -1
- package/dist/utils/error-codes.d.mts +2 -2
- package/dist/utils/host.d.mts +27 -1
- package/dist/utils/host.mjs +1 -1
- package/dist/utils/ip.d.mts +1 -0
- package/dist/utils/ip.mjs +1 -1
- package/dist/utils/is-api-error.d.mts +0 -1
- package/dist/utils/redirect-uri.d.mts +0 -1
- package/package.json +10 -2
- package/src/context/request-state.ts +26 -6
- package/src/context/transaction.ts +37 -18
- package/src/db/adapter/factory.ts +24 -18
- package/src/db/adapter/get-default-model-name.ts +23 -14
- package/src/db/database-index.ts +351 -0
- package/src/db/get-tables.ts +89 -9
- package/src/db/index.ts +4 -0
- package/src/db/internal.ts +12 -0
- package/src/db/plugin.ts +3 -1
- package/src/db/schema/account.ts +27 -1
- package/src/db/schema/user.ts +1 -1
- package/src/db/type.ts +12 -0
- package/src/oauth2/index.ts +3 -0
- package/src/oauth2/oauth-provider.ts +94 -36
- package/src/oauth2/verify-id-token.ts +4 -2
- package/src/social-providers/apple.ts +2 -1
- package/src/social-providers/atlassian.ts +1 -1
- package/src/social-providers/cognito.ts +2 -2
- package/src/social-providers/discord.ts +1 -1
- package/src/social-providers/dropbox.ts +1 -1
- package/src/social-providers/facebook.ts +21 -28
- package/src/social-providers/figma.ts +1 -1
- package/src/social-providers/github.ts +1 -1
- package/src/social-providers/gitlab.ts +1 -1
- package/src/social-providers/google.ts +2 -1
- package/src/social-providers/huggingface.ts +1 -1
- package/src/social-providers/kakao.ts +1 -1
- package/src/social-providers/kick.ts +1 -1
- package/src/social-providers/line.ts +7 -12
- package/src/social-providers/linear.ts +1 -1
- package/src/social-providers/linkedin.ts +1 -1
- package/src/social-providers/microsoft-entra-id.ts +3 -2
- package/src/social-providers/naver.ts +1 -1
- package/src/social-providers/notion.ts +1 -1
- package/src/social-providers/paybin.ts +2 -1
- package/src/social-providers/paypal.ts +1 -1
- package/src/social-providers/polar.ts +1 -1
- package/src/social-providers/railway.ts +1 -1
- package/src/social-providers/reddit.ts +1 -1
- package/src/social-providers/roblox.ts +1 -1
- package/src/social-providers/salesforce.ts +1 -1
- package/src/social-providers/slack.ts +1 -1
- package/src/social-providers/spotify.ts +1 -1
- package/src/social-providers/tiktok.ts +2 -2
- package/src/social-providers/twitch.ts +1 -1
- package/src/social-providers/twitter.ts +1 -1
- package/src/social-providers/vercel.ts +1 -1
- package/src/social-providers/vk.ts +2 -2
- package/src/social-providers/wechat.ts +1 -1
- package/src/social-providers/zoom.ts +1 -1
- package/src/types/context.ts +21 -14
- package/src/types/init-options.ts +15 -14
|
@@ -8,6 +8,7 @@ const notion = (options) => {
|
|
|
8
8
|
return {
|
|
9
9
|
id: "notion",
|
|
10
10
|
name: "Notion",
|
|
11
|
+
accountSubject: ({ profile }) => profile.id,
|
|
11
12
|
createAuthorizationURL({ state, scopes, loginHint, redirectURI, additionalParams }) {
|
|
12
13
|
const _scopes = options.disableDefaultScope ? [] : [];
|
|
13
14
|
if (options.scope) _scopes.push(...options.scope);
|
|
@@ -58,7 +59,6 @@ const notion = (options) => {
|
|
|
58
59
|
const userMap = await options.mapProfileToUser?.(userProfile);
|
|
59
60
|
return {
|
|
60
61
|
user: {
|
|
61
|
-
id: userProfile.id,
|
|
62
62
|
name: userProfile.name || "",
|
|
63
63
|
email: userProfile.person?.email || null,
|
|
64
64
|
image: userProfile.avatar_url,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/paybin.d.ts
|
|
3
4
|
interface PaybinProfile {
|
|
4
5
|
sub: string;
|
|
@@ -21,14 +22,9 @@ interface PaybinOptions extends ProviderOptions<PaybinProfile> {
|
|
|
21
22
|
declare const paybin: (options: PaybinOptions) => {
|
|
22
23
|
id: "paybin";
|
|
23
24
|
name: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
codeVerifier,
|
|
28
|
-
redirectURI,
|
|
29
|
-
loginHint,
|
|
30
|
-
additionalParams
|
|
31
|
-
}: {
|
|
25
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<PaybinProfile>) => string;
|
|
26
|
+
accountIssuer: string;
|
|
27
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint, additionalParams }: {
|
|
32
28
|
state: string;
|
|
33
29
|
codeVerifier: string;
|
|
34
30
|
scopes?: string[] | undefined;
|
|
@@ -38,11 +34,7 @@ declare const paybin: (options: PaybinOptions) => {
|
|
|
38
34
|
idTokenNonce?: string | undefined;
|
|
39
35
|
additionalParams?: Record<string, string> | undefined;
|
|
40
36
|
}): Promise<URL>;
|
|
41
|
-
validateAuthorizationCode: ({
|
|
42
|
-
code,
|
|
43
|
-
codeVerifier,
|
|
44
|
-
redirectURI
|
|
45
|
-
}: {
|
|
37
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
46
38
|
code: string;
|
|
47
39
|
redirectURI: string;
|
|
48
40
|
codeVerifier?: string | undefined;
|
|
@@ -59,15 +51,8 @@ declare const paybin: (options: PaybinOptions) => {
|
|
|
59
51
|
email?: string;
|
|
60
52
|
} | undefined;
|
|
61
53
|
}): Promise<{
|
|
62
|
-
user:
|
|
63
|
-
|
|
64
|
-
name?: string;
|
|
65
|
-
email?: string | null;
|
|
66
|
-
image?: string;
|
|
67
|
-
emailVerified: boolean;
|
|
68
|
-
[key: string]: any;
|
|
69
|
-
};
|
|
70
|
-
data: any;
|
|
54
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
55
|
+
data: PaybinProfile;
|
|
71
56
|
} | null>;
|
|
72
57
|
options: PaybinOptions;
|
|
73
58
|
};
|
|
@@ -12,6 +12,8 @@ const paybin = (options) => {
|
|
|
12
12
|
return {
|
|
13
13
|
id: "paybin",
|
|
14
14
|
name: "Paybin",
|
|
15
|
+
accountSubject: ({ profile }) => profile.sub,
|
|
16
|
+
accountIssuer: issuer,
|
|
15
17
|
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint, additionalParams }) {
|
|
16
18
|
if (!options.clientId || !options.clientSecret) {
|
|
17
19
|
logger.error("Client Id and Client Secret is required for Paybin. Make sure to provide them in the options.");
|
|
@@ -65,7 +67,6 @@ const paybin = (options) => {
|
|
|
65
67
|
const userMap = await options.mapProfileToUser?.(user);
|
|
66
68
|
return {
|
|
67
69
|
user: {
|
|
68
|
-
id: user.sub,
|
|
69
70
|
name: user.name || user.preferred_username || "",
|
|
70
71
|
email: user.email,
|
|
71
72
|
image: user.picture,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/paypal.d.ts
|
|
3
4
|
interface PayPalProfile {
|
|
4
5
|
sub?: string | undefined;
|
|
@@ -52,12 +53,8 @@ interface PayPalOptions extends ProviderOptions<PayPalProfile> {
|
|
|
52
53
|
declare const paypal: (options: PayPalOptions) => {
|
|
53
54
|
id: "paypal";
|
|
54
55
|
name: string;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
codeVerifier,
|
|
58
|
-
redirectURI,
|
|
59
|
-
additionalParams
|
|
60
|
-
}: {
|
|
56
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<PayPalProfile>) => string;
|
|
57
|
+
createAuthorizationURL({ state, codeVerifier, redirectURI, additionalParams }: {
|
|
61
58
|
state: string;
|
|
62
59
|
codeVerifier: string;
|
|
63
60
|
scopes?: string[] | undefined;
|
|
@@ -67,10 +64,7 @@ declare const paypal: (options: PayPalOptions) => {
|
|
|
67
64
|
idTokenNonce?: string | undefined;
|
|
68
65
|
additionalParams?: Record<string, string> | undefined;
|
|
69
66
|
}): Promise<URL>;
|
|
70
|
-
validateAuthorizationCode: ({
|
|
71
|
-
code,
|
|
72
|
-
redirectURI
|
|
73
|
-
}: {
|
|
67
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
74
68
|
code: string;
|
|
75
69
|
redirectURI: string;
|
|
76
70
|
codeVerifier?: string | undefined;
|
|
@@ -96,30 +90,11 @@ declare const paypal: (options: PayPalOptions) => {
|
|
|
96
90
|
email?: string;
|
|
97
91
|
} | undefined;
|
|
98
92
|
}): Promise<{
|
|
99
|
-
user:
|
|
100
|
-
|
|
101
|
-
name?: string;
|
|
102
|
-
email?: string | null;
|
|
103
|
-
image?: string;
|
|
104
|
-
emailVerified: boolean;
|
|
105
|
-
[key: string]: any;
|
|
106
|
-
};
|
|
107
|
-
data: any;
|
|
93
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
94
|
+
data: PayPalProfile;
|
|
108
95
|
} | {
|
|
109
96
|
user: {
|
|
110
|
-
id
|
|
111
|
-
name: string;
|
|
112
|
-
email: string;
|
|
113
|
-
image: string | undefined;
|
|
114
|
-
emailVerified: boolean;
|
|
115
|
-
} | {
|
|
116
|
-
id: string;
|
|
117
|
-
name: string;
|
|
118
|
-
email: string | null;
|
|
119
|
-
image: string;
|
|
120
|
-
emailVerified: boolean;
|
|
121
|
-
} | {
|
|
122
|
-
id: string;
|
|
97
|
+
id?: never;
|
|
123
98
|
name: string;
|
|
124
99
|
email: string | null;
|
|
125
100
|
image: string;
|
|
@@ -13,6 +13,7 @@ const paypal = (options) => {
|
|
|
13
13
|
return {
|
|
14
14
|
id: "paypal",
|
|
15
15
|
name: "PayPal",
|
|
16
|
+
accountSubject: ({ profile }) => profile.user_id,
|
|
16
17
|
async createAuthorizationURL({ state, codeVerifier, redirectURI, additionalParams }) {
|
|
17
18
|
if (!options.clientId || !options.clientSecret) {
|
|
18
19
|
logger.error("Client Id and Client Secret is required for PayPal. Make sure to provide them in the options.");
|
|
@@ -124,7 +125,6 @@ const paypal = (options) => {
|
|
|
124
125
|
const userMap = await options.mapProfileToUser?.(userInfo);
|
|
125
126
|
return {
|
|
126
127
|
user: {
|
|
127
|
-
id: userInfo.user_id,
|
|
128
128
|
name: userInfo.name,
|
|
129
129
|
email: userInfo.email,
|
|
130
130
|
image: userInfo.picture,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/polar.d.ts
|
|
3
4
|
interface PolarProfile {
|
|
4
5
|
id: string;
|
|
@@ -25,13 +26,8 @@ interface PolarOptions extends ProviderOptions<PolarProfile> {}
|
|
|
25
26
|
declare const polar: (options: PolarOptions) => {
|
|
26
27
|
id: "polar";
|
|
27
28
|
name: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
scopes,
|
|
31
|
-
codeVerifier,
|
|
32
|
-
redirectURI,
|
|
33
|
-
additionalParams
|
|
34
|
-
}: {
|
|
29
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<PolarProfile>) => string;
|
|
30
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }: {
|
|
35
31
|
state: string;
|
|
36
32
|
codeVerifier: string;
|
|
37
33
|
scopes?: string[] | undefined;
|
|
@@ -41,11 +37,7 @@ declare const polar: (options: PolarOptions) => {
|
|
|
41
37
|
idTokenNonce?: string | undefined;
|
|
42
38
|
additionalParams?: Record<string, string> | undefined;
|
|
43
39
|
}): Promise<URL>;
|
|
44
|
-
validateAuthorizationCode: ({
|
|
45
|
-
code,
|
|
46
|
-
codeVerifier,
|
|
47
|
-
redirectURI
|
|
48
|
-
}: {
|
|
40
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
49
41
|
code: string;
|
|
50
42
|
redirectURI: string;
|
|
51
43
|
codeVerifier?: string | undefined;
|
|
@@ -62,15 +54,8 @@ declare const polar: (options: PolarOptions) => {
|
|
|
62
54
|
email?: string;
|
|
63
55
|
} | undefined;
|
|
64
56
|
}): Promise<{
|
|
65
|
-
user:
|
|
66
|
-
|
|
67
|
-
name?: string;
|
|
68
|
-
email?: string | null;
|
|
69
|
-
image?: string;
|
|
70
|
-
emailVerified: boolean;
|
|
71
|
-
[key: string]: any;
|
|
72
|
-
};
|
|
73
|
-
data: any;
|
|
57
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
58
|
+
data: PolarProfile;
|
|
74
59
|
} | null>;
|
|
75
60
|
options: PolarOptions;
|
|
76
61
|
};
|
|
@@ -8,6 +8,7 @@ const polar = (options) => {
|
|
|
8
8
|
return {
|
|
9
9
|
id: "polar",
|
|
10
10
|
name: "Polar",
|
|
11
|
+
accountSubject: ({ profile }) => profile.id,
|
|
11
12
|
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }) {
|
|
12
13
|
const _scopes = options.disableDefaultScope ? [] : [
|
|
13
14
|
"openid",
|
|
@@ -55,7 +56,6 @@ const polar = (options) => {
|
|
|
55
56
|
const userMap = await options.mapProfileToUser?.(profile);
|
|
56
57
|
return {
|
|
57
58
|
user: {
|
|
58
|
-
id: profile.id,
|
|
59
59
|
name: profile.public_name || profile.username || "",
|
|
60
60
|
email: profile.email,
|
|
61
61
|
image: profile.avatar_url,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/railway.d.ts
|
|
3
4
|
interface RailwayProfile {
|
|
4
5
|
/** The user's unique ID (OAuth `sub` claim). */
|
|
@@ -16,13 +17,8 @@ interface RailwayOptions extends ProviderOptions<RailwayProfile> {
|
|
|
16
17
|
declare const railway: (options: RailwayOptions) => {
|
|
17
18
|
id: "railway";
|
|
18
19
|
name: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
scopes,
|
|
22
|
-
codeVerifier,
|
|
23
|
-
redirectURI,
|
|
24
|
-
additionalParams
|
|
25
|
-
}: {
|
|
20
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<RailwayProfile>) => string;
|
|
21
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }: {
|
|
26
22
|
state: string;
|
|
27
23
|
codeVerifier: string;
|
|
28
24
|
scopes?: string[] | undefined;
|
|
@@ -32,11 +28,7 @@ declare const railway: (options: RailwayOptions) => {
|
|
|
32
28
|
idTokenNonce?: string | undefined;
|
|
33
29
|
additionalParams?: Record<string, string> | undefined;
|
|
34
30
|
}): Promise<URL>;
|
|
35
|
-
validateAuthorizationCode: ({
|
|
36
|
-
code,
|
|
37
|
-
codeVerifier,
|
|
38
|
-
redirectURI
|
|
39
|
-
}: {
|
|
31
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
40
32
|
code: string;
|
|
41
33
|
redirectURI: string;
|
|
42
34
|
codeVerifier?: string | undefined;
|
|
@@ -53,15 +45,8 @@ declare const railway: (options: RailwayOptions) => {
|
|
|
53
45
|
email?: string;
|
|
54
46
|
} | undefined;
|
|
55
47
|
}): Promise<{
|
|
56
|
-
user:
|
|
57
|
-
|
|
58
|
-
name?: string;
|
|
59
|
-
email?: string | null;
|
|
60
|
-
image?: string;
|
|
61
|
-
emailVerified: boolean;
|
|
62
|
-
[key: string]: any;
|
|
63
|
-
};
|
|
64
|
-
data: any;
|
|
48
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
49
|
+
data: RailwayProfile;
|
|
65
50
|
} | null>;
|
|
66
51
|
options: RailwayOptions;
|
|
67
52
|
};
|
|
@@ -10,6 +10,7 @@ const railway = (options) => {
|
|
|
10
10
|
return {
|
|
11
11
|
id: "railway",
|
|
12
12
|
name: "Railway",
|
|
13
|
+
accountSubject: ({ profile }) => profile.sub,
|
|
13
14
|
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }) {
|
|
14
15
|
const _scopes = options.disableDefaultScope ? [] : [
|
|
15
16
|
"openid",
|
|
@@ -58,7 +59,6 @@ const railway = (options) => {
|
|
|
58
59
|
const userMap = await options.mapProfileToUser?.(profile);
|
|
59
60
|
return {
|
|
60
61
|
user: {
|
|
61
|
-
id: profile.sub,
|
|
62
62
|
name: profile.name,
|
|
63
63
|
email: profile.email,
|
|
64
64
|
image: profile.picture,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/reddit.d.ts
|
|
3
4
|
interface RedditProfile {
|
|
4
5
|
id: string;
|
|
@@ -15,12 +16,8 @@ interface RedditOptions extends ProviderOptions<RedditProfile> {
|
|
|
15
16
|
declare const reddit: (options: RedditOptions) => {
|
|
16
17
|
id: "reddit";
|
|
17
18
|
name: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
scopes,
|
|
21
|
-
redirectURI,
|
|
22
|
-
additionalParams
|
|
23
|
-
}: {
|
|
19
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<RedditProfile>) => string;
|
|
20
|
+
createAuthorizationURL({ state, scopes, redirectURI, additionalParams }: {
|
|
24
21
|
state: string;
|
|
25
22
|
codeVerifier: string;
|
|
26
23
|
scopes?: string[] | undefined;
|
|
@@ -30,10 +27,7 @@ declare const reddit: (options: RedditOptions) => {
|
|
|
30
27
|
idTokenNonce?: string | undefined;
|
|
31
28
|
additionalParams?: Record<string, string> | undefined;
|
|
32
29
|
}): Promise<URL>;
|
|
33
|
-
validateAuthorizationCode: ({
|
|
34
|
-
code,
|
|
35
|
-
redirectURI
|
|
36
|
-
}: {
|
|
30
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
37
31
|
code: string;
|
|
38
32
|
redirectURI: string;
|
|
39
33
|
codeVerifier?: string | undefined;
|
|
@@ -50,15 +44,8 @@ declare const reddit: (options: RedditOptions) => {
|
|
|
50
44
|
email?: string;
|
|
51
45
|
} | undefined;
|
|
52
46
|
}): Promise<{
|
|
53
|
-
user:
|
|
54
|
-
|
|
55
|
-
name?: string;
|
|
56
|
-
email?: string | null;
|
|
57
|
-
image?: string;
|
|
58
|
-
emailVerified: boolean;
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
};
|
|
61
|
-
data: any;
|
|
47
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
48
|
+
data: RedditProfile;
|
|
62
49
|
} | null>;
|
|
63
50
|
options: RedditOptions;
|
|
64
51
|
};
|
|
@@ -8,6 +8,7 @@ const reddit = (options) => {
|
|
|
8
8
|
return {
|
|
9
9
|
id: "reddit",
|
|
10
10
|
name: "Reddit",
|
|
11
|
+
accountSubject: ({ profile }) => profile.id,
|
|
11
12
|
createAuthorizationURL({ state, scopes, redirectURI, additionalParams }) {
|
|
12
13
|
const _scopes = options.disableDefaultScope ? [] : ["identity"];
|
|
13
14
|
if (options.scope) _scopes.push(...options.scope);
|
|
@@ -65,7 +66,6 @@ const reddit = (options) => {
|
|
|
65
66
|
const email = userMap?.email || `${profile.id}@reddit.invalid`;
|
|
66
67
|
return {
|
|
67
68
|
user: {
|
|
68
|
-
id: profile.id,
|
|
69
69
|
name: profile.name,
|
|
70
70
|
image: profile.icon_img?.split("?")[0],
|
|
71
71
|
...userMap,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/roblox.d.ts
|
|
3
4
|
interface RobloxProfile extends Record<string, any> {
|
|
4
5
|
/** the user's id */
|
|
@@ -23,12 +24,8 @@ interface RobloxOptions extends ProviderOptions<RobloxProfile> {
|
|
|
23
24
|
declare const roblox: (options: RobloxOptions) => {
|
|
24
25
|
id: "roblox";
|
|
25
26
|
name: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
scopes,
|
|
29
|
-
redirectURI,
|
|
30
|
-
additionalParams
|
|
31
|
-
}: {
|
|
27
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<RobloxProfile>) => string;
|
|
28
|
+
createAuthorizationURL({ state, scopes, redirectURI, additionalParams }: {
|
|
32
29
|
state: string;
|
|
33
30
|
codeVerifier: string;
|
|
34
31
|
scopes?: string[] | undefined;
|
|
@@ -38,10 +35,7 @@ declare const roblox: (options: RobloxOptions) => {
|
|
|
38
35
|
idTokenNonce?: string | undefined;
|
|
39
36
|
additionalParams?: Record<string, string> | undefined;
|
|
40
37
|
}): Promise<URL>;
|
|
41
|
-
validateAuthorizationCode: ({
|
|
42
|
-
code,
|
|
43
|
-
redirectURI
|
|
44
|
-
}: {
|
|
38
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
45
39
|
code: string;
|
|
46
40
|
redirectURI: string;
|
|
47
41
|
codeVerifier?: string | undefined;
|
|
@@ -58,15 +52,8 @@ declare const roblox: (options: RobloxOptions) => {
|
|
|
58
52
|
email?: string;
|
|
59
53
|
} | undefined;
|
|
60
54
|
}): Promise<{
|
|
61
|
-
user:
|
|
62
|
-
|
|
63
|
-
name?: string;
|
|
64
|
-
email?: string | null;
|
|
65
|
-
image?: string;
|
|
66
|
-
emailVerified: boolean;
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
};
|
|
69
|
-
data: any;
|
|
55
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
56
|
+
data: RobloxProfile;
|
|
70
57
|
} | null>;
|
|
71
58
|
options: RobloxOptions;
|
|
72
59
|
};
|
|
@@ -8,6 +8,7 @@ const roblox = (options) => {
|
|
|
8
8
|
return {
|
|
9
9
|
id: "roblox",
|
|
10
10
|
name: "Roblox",
|
|
11
|
+
accountSubject: ({ profile }) => profile.sub,
|
|
11
12
|
createAuthorizationURL({ state, scopes, redirectURI, additionalParams }) {
|
|
12
13
|
const _scopes = options.disableDefaultScope ? [] : ["openid", "profile"];
|
|
13
14
|
if (options.scope) _scopes.push(...options.scope);
|
|
@@ -50,7 +51,6 @@ const roblox = (options) => {
|
|
|
50
51
|
const userMap = await options.mapProfileToUser?.(profile);
|
|
51
52
|
return {
|
|
52
53
|
user: {
|
|
53
|
-
id: profile.sub,
|
|
54
54
|
name: profile.nickname || profile.preferred_username || "",
|
|
55
55
|
image: profile.picture,
|
|
56
56
|
email: profile.preferred_username || null,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/salesforce.d.ts
|
|
3
4
|
interface SalesforceProfile {
|
|
4
5
|
sub: string;
|
|
@@ -30,13 +31,8 @@ interface SalesforceOptions extends ProviderOptions<SalesforceProfile> {
|
|
|
30
31
|
declare const salesforce: (options: SalesforceOptions) => {
|
|
31
32
|
id: "salesforce";
|
|
32
33
|
name: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
scopes,
|
|
36
|
-
codeVerifier,
|
|
37
|
-
redirectURI,
|
|
38
|
-
additionalParams
|
|
39
|
-
}: {
|
|
34
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<SalesforceProfile>) => string;
|
|
35
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }: {
|
|
40
36
|
state: string;
|
|
41
37
|
codeVerifier: string;
|
|
42
38
|
scopes?: string[] | undefined;
|
|
@@ -46,11 +42,7 @@ declare const salesforce: (options: SalesforceOptions) => {
|
|
|
46
42
|
idTokenNonce?: string | undefined;
|
|
47
43
|
additionalParams?: Record<string, string> | undefined;
|
|
48
44
|
}): Promise<URL>;
|
|
49
|
-
validateAuthorizationCode: ({
|
|
50
|
-
code,
|
|
51
|
-
codeVerifier,
|
|
52
|
-
redirectURI
|
|
53
|
-
}: {
|
|
45
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
54
46
|
code: string;
|
|
55
47
|
redirectURI: string;
|
|
56
48
|
codeVerifier?: string | undefined;
|
|
@@ -67,15 +59,8 @@ declare const salesforce: (options: SalesforceOptions) => {
|
|
|
67
59
|
email?: string;
|
|
68
60
|
} | undefined;
|
|
69
61
|
}): Promise<{
|
|
70
|
-
user:
|
|
71
|
-
|
|
72
|
-
name?: string;
|
|
73
|
-
email?: string | null;
|
|
74
|
-
image?: string;
|
|
75
|
-
emailVerified: boolean;
|
|
76
|
-
[key: string]: any;
|
|
77
|
-
};
|
|
78
|
-
data: any;
|
|
62
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
63
|
+
data: SalesforceProfile;
|
|
79
64
|
} | null>;
|
|
80
65
|
options: SalesforceOptions;
|
|
81
66
|
};
|
|
@@ -13,6 +13,7 @@ const salesforce = (options) => {
|
|
|
13
13
|
return {
|
|
14
14
|
id: "salesforce",
|
|
15
15
|
name: "Salesforce",
|
|
16
|
+
accountSubject: ({ profile }) => profile.user_id,
|
|
16
17
|
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }) {
|
|
17
18
|
if (!options.clientId || !options.clientSecret) {
|
|
18
19
|
logger.error("Client Id and Client Secret are required for Salesforce. Make sure to provide them in the options.");
|
|
@@ -67,7 +68,6 @@ const salesforce = (options) => {
|
|
|
67
68
|
const userMap = await options.mapProfileToUser?.(user);
|
|
68
69
|
return {
|
|
69
70
|
user: {
|
|
70
|
-
id: user.user_id,
|
|
71
71
|
name: user.name,
|
|
72
72
|
email: user.email,
|
|
73
73
|
image: user.photos?.picture || user.photos?.thumbnail,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/slack.d.ts
|
|
3
4
|
interface SlackProfile extends Record<string, any> {
|
|
4
5
|
ok: boolean;
|
|
@@ -36,12 +37,8 @@ interface SlackOptions extends ProviderOptions<SlackProfile> {
|
|
|
36
37
|
declare const slack: (options: SlackOptions) => {
|
|
37
38
|
id: "slack";
|
|
38
39
|
name: string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
scopes,
|
|
42
|
-
redirectURI,
|
|
43
|
-
additionalParams
|
|
44
|
-
}: {
|
|
40
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<SlackProfile>) => string;
|
|
41
|
+
createAuthorizationURL({ state, scopes, redirectURI, additionalParams }: {
|
|
45
42
|
state: string;
|
|
46
43
|
codeVerifier: string;
|
|
47
44
|
scopes?: string[] | undefined;
|
|
@@ -51,10 +48,7 @@ declare const slack: (options: SlackOptions) => {
|
|
|
51
48
|
idTokenNonce?: string | undefined;
|
|
52
49
|
additionalParams?: Record<string, string> | undefined;
|
|
53
50
|
}): Promise<URL>;
|
|
54
|
-
validateAuthorizationCode: ({
|
|
55
|
-
code,
|
|
56
|
-
redirectURI
|
|
57
|
-
}: {
|
|
51
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
58
52
|
code: string;
|
|
59
53
|
redirectURI: string;
|
|
60
54
|
codeVerifier?: string | undefined;
|
|
@@ -71,15 +65,8 @@ declare const slack: (options: SlackOptions) => {
|
|
|
71
65
|
email?: string;
|
|
72
66
|
} | undefined;
|
|
73
67
|
}): Promise<{
|
|
74
|
-
user:
|
|
75
|
-
|
|
76
|
-
name?: string;
|
|
77
|
-
email?: string | null;
|
|
78
|
-
image?: string;
|
|
79
|
-
emailVerified: boolean;
|
|
80
|
-
[key: string]: any;
|
|
81
|
-
};
|
|
82
|
-
data: any;
|
|
68
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
69
|
+
data: SlackProfile;
|
|
83
70
|
} | null>;
|
|
84
71
|
options: SlackOptions;
|
|
85
72
|
};
|
|
@@ -8,6 +8,7 @@ const slack = (options) => {
|
|
|
8
8
|
return {
|
|
9
9
|
id: "slack",
|
|
10
10
|
name: "Slack",
|
|
11
|
+
accountSubject: ({ profile }) => profile["https://slack.com/user_id"],
|
|
11
12
|
createAuthorizationURL({ state, scopes, redirectURI, additionalParams }) {
|
|
12
13
|
const _scopes = options.disableDefaultScope ? [] : [
|
|
13
14
|
"openid",
|
|
@@ -52,7 +53,6 @@ const slack = (options) => {
|
|
|
52
53
|
const userMap = await options.mapProfileToUser?.(profile);
|
|
53
54
|
return {
|
|
54
55
|
user: {
|
|
55
|
-
id: profile["https://slack.com/user_id"],
|
|
56
56
|
name: profile.name || "",
|
|
57
57
|
email: profile.email,
|
|
58
58
|
emailVerified: profile.email_verified,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
1
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/spotify.d.ts
|
|
3
4
|
interface SpotifyProfile {
|
|
4
5
|
id: string;
|
|
@@ -14,13 +15,8 @@ interface SpotifyOptions extends ProviderOptions<SpotifyProfile> {
|
|
|
14
15
|
declare const spotify: (options: SpotifyOptions) => {
|
|
15
16
|
id: "spotify";
|
|
16
17
|
name: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
scopes,
|
|
20
|
-
codeVerifier,
|
|
21
|
-
redirectURI,
|
|
22
|
-
additionalParams
|
|
23
|
-
}: {
|
|
18
|
+
accountSubject: ({ profile }: OAuthAccountKeyContext<SpotifyProfile>) => string;
|
|
19
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }: {
|
|
24
20
|
state: string;
|
|
25
21
|
codeVerifier: string;
|
|
26
22
|
scopes?: string[] | undefined;
|
|
@@ -30,11 +26,7 @@ declare const spotify: (options: SpotifyOptions) => {
|
|
|
30
26
|
idTokenNonce?: string | undefined;
|
|
31
27
|
additionalParams?: Record<string, string> | undefined;
|
|
32
28
|
}): Promise<URL>;
|
|
33
|
-
validateAuthorizationCode: ({
|
|
34
|
-
code,
|
|
35
|
-
codeVerifier,
|
|
36
|
-
redirectURI
|
|
37
|
-
}: {
|
|
29
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
38
30
|
code: string;
|
|
39
31
|
redirectURI: string;
|
|
40
32
|
codeVerifier?: string | undefined;
|
|
@@ -51,15 +43,8 @@ declare const spotify: (options: SpotifyOptions) => {
|
|
|
51
43
|
email?: string;
|
|
52
44
|
} | undefined;
|
|
53
45
|
}): Promise<{
|
|
54
|
-
user:
|
|
55
|
-
|
|
56
|
-
name?: string;
|
|
57
|
-
email?: string | null;
|
|
58
|
-
image?: string;
|
|
59
|
-
emailVerified: boolean;
|
|
60
|
-
[key: string]: any;
|
|
61
|
-
};
|
|
62
|
-
data: any;
|
|
46
|
+
user: OAuth2UserInfo & Record<string, unknown>;
|
|
47
|
+
data: SpotifyProfile;
|
|
63
48
|
} | null>;
|
|
64
49
|
options: SpotifyOptions;
|
|
65
50
|
};
|
|
@@ -8,6 +8,7 @@ const spotify = (options) => {
|
|
|
8
8
|
return {
|
|
9
9
|
id: "spotify",
|
|
10
10
|
name: "Spotify",
|
|
11
|
+
accountSubject: ({ profile }) => profile.id,
|
|
11
12
|
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, additionalParams }) {
|
|
12
13
|
const _scopes = options.disableDefaultScope ? [] : ["user-read-email"];
|
|
13
14
|
if (options.scope) _scopes.push(...options.scope);
|
|
@@ -53,7 +54,6 @@ const spotify = (options) => {
|
|
|
53
54
|
const userMap = await options.mapProfileToUser?.(profile);
|
|
54
55
|
return {
|
|
55
56
|
user: {
|
|
56
|
-
id: profile.id,
|
|
57
57
|
name: profile.display_name,
|
|
58
58
|
email: profile.email,
|
|
59
59
|
image: profile.images[0]?.url,
|