@better-auth/core 1.6.23 → 1.6.24
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 +1 -1
- package/dist/db/adapter/factory.d.mts +3 -5
- package/dist/db/adapter/factory.mjs +1 -1
- 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/get-tables.d.mts +1 -0
- package/dist/db/get-tables.mjs +2 -2
- package/dist/db/plugin.d.mts +1 -2
- package/dist/db/schema/account.d.mts +1 -1
- package/dist/db/schema/account.mjs +12 -0
- 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 +5 -8
- 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/client-credentials-token.d.mts +4 -20
- package/dist/oauth2/client-credentials-token.mjs +1 -4
- package/dist/oauth2/create-authorization-url.d.mts +3 -20
- package/dist/oauth2/oauth-provider.d.mts +9 -3
- package/dist/oauth2/refresh-access-token.d.mts +4 -22
- package/dist/oauth2/refresh-access-token.mjs +2 -8
- package/dist/oauth2/reject-redirects.mjs +1 -1
- package/dist/oauth2/utils.d.mts +0 -1
- package/dist/oauth2/utils.mjs +1 -2
- package/dist/oauth2/validate-authorization-code.d.mts +6 -37
- package/dist/oauth2/verify.d.mts +12 -10
- package/dist/oauth2/verify.mjs +2 -2
- package/dist/social-providers/apple.d.mts +7 -28
- package/dist/social-providers/apple.mjs +2 -2
- package/dist/social-providers/atlassian.d.mts +3 -11
- package/dist/social-providers/cognito.d.mts +6 -12
- package/dist/social-providers/cognito.mjs +2 -2
- package/dist/social-providers/discord.d.mts +3 -9
- package/dist/social-providers/dropbox.d.mts +3 -11
- package/dist/social-providers/facebook.d.mts +6 -11
- package/dist/social-providers/facebook.mjs +2 -2
- package/dist/social-providers/figma.d.mts +3 -11
- package/dist/social-providers/github.d.mts +3 -12
- package/dist/social-providers/gitlab.d.mts +3 -12
- package/dist/social-providers/google.d.mts +7 -20
- package/dist/social-providers/google.mjs +2 -2
- package/dist/social-providers/huggingface.d.mts +3 -11
- package/dist/social-providers/index.d.mts +78 -362
- package/dist/social-providers/kakao.d.mts +3 -9
- package/dist/social-providers/kick.d.mts +3 -11
- package/dist/social-providers/line.d.mts +6 -13
- package/dist/social-providers/line.mjs +2 -2
- package/dist/social-providers/linear.d.mts +3 -10
- package/dist/social-providers/linkedin.d.mts +3 -10
- package/dist/social-providers/microsoft-entra-id.d.mts +5 -6
- package/dist/social-providers/microsoft-entra-id.mjs +4 -3
- package/dist/social-providers/naver.d.mts +22 -18
- package/dist/social-providers/notion.d.mts +3 -10
- package/dist/social-providers/paybin.d.mts +3 -12
- package/dist/social-providers/paypal.d.mts +6 -10
- package/dist/social-providers/paypal.mjs +2 -2
- package/dist/social-providers/polar.d.mts +3 -11
- package/dist/social-providers/railway.d.mts +3 -11
- package/dist/social-providers/reddit.d.mts +3 -9
- package/dist/social-providers/roblox.d.mts +3 -9
- package/dist/social-providers/salesforce.d.mts +3 -11
- package/dist/social-providers/slack.d.mts +3 -9
- package/dist/social-providers/spotify.d.mts +3 -11
- package/dist/social-providers/tiktok.d.mts +5 -10
- package/dist/social-providers/twitch.d.mts +3 -9
- package/dist/social-providers/twitter.d.mts +26 -17
- package/dist/social-providers/vercel.d.mts +3 -11
- package/dist/social-providers/vk.d.mts +3 -12
- package/dist/social-providers/vk.mjs +4 -5
- package/dist/social-providers/wechat.d.mts +3 -8
- package/dist/social-providers/zoom.d.mts +5 -14
- package/dist/types/context.d.mts +2 -1
- 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 +10 -7
- 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 +2 -2
- package/src/context/request-state.ts +26 -6
- package/src/db/adapter/get-default-model-name.ts +23 -14
- package/src/db/get-tables.ts +17 -2
- package/src/oauth2/oauth-provider.ts +20 -4
- package/src/social-providers/apple.ts +7 -2
- package/src/social-providers/cognito.ts +7 -2
- package/src/social-providers/facebook.ts +7 -2
- package/src/social-providers/google.ts +7 -2
- package/src/social-providers/line.ts +7 -2
- package/src/social-providers/microsoft-entra-id.ts +7 -2
- package/src/social-providers/paypal.ts +7 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/kakao.d.ts
|
|
3
4
|
interface Partner {
|
|
4
5
|
/** Partner-specific ID (consent required: kakaotalk_message) */
|
|
@@ -93,11 +94,7 @@ interface KakaoOptions extends ProviderOptions<KakaoProfile> {
|
|
|
93
94
|
declare const kakao: (options: KakaoOptions) => {
|
|
94
95
|
id: "kakao";
|
|
95
96
|
name: string;
|
|
96
|
-
createAuthorizationURL({
|
|
97
|
-
state,
|
|
98
|
-
scopes,
|
|
99
|
-
redirectURI
|
|
100
|
-
}: {
|
|
97
|
+
createAuthorizationURL({ state, scopes, redirectURI }: {
|
|
101
98
|
state: string;
|
|
102
99
|
codeVerifier: string;
|
|
103
100
|
scopes?: string[] | undefined;
|
|
@@ -105,10 +102,7 @@ declare const kakao: (options: KakaoOptions) => {
|
|
|
105
102
|
display?: string | undefined;
|
|
106
103
|
loginHint?: string | undefined;
|
|
107
104
|
}): Promise<URL>;
|
|
108
|
-
validateAuthorizationCode: ({
|
|
109
|
-
code,
|
|
110
|
-
redirectURI
|
|
111
|
-
}: {
|
|
105
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
112
106
|
code: string;
|
|
113
107
|
redirectURI: string;
|
|
114
108
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/kick.d.ts
|
|
3
4
|
interface KickProfile {
|
|
4
5
|
/**
|
|
@@ -24,12 +25,7 @@ interface KickOptions extends ProviderOptions<KickProfile> {
|
|
|
24
25
|
declare const kick: (options: KickOptions) => {
|
|
25
26
|
id: "kick";
|
|
26
27
|
name: string;
|
|
27
|
-
createAuthorizationURL({
|
|
28
|
-
state,
|
|
29
|
-
scopes,
|
|
30
|
-
redirectURI,
|
|
31
|
-
codeVerifier
|
|
32
|
-
}: {
|
|
28
|
+
createAuthorizationURL({ state, scopes, redirectURI, codeVerifier }: {
|
|
33
29
|
state: string;
|
|
34
30
|
codeVerifier: string;
|
|
35
31
|
scopes?: string[] | undefined;
|
|
@@ -37,11 +33,7 @@ declare const kick: (options: KickOptions) => {
|
|
|
37
33
|
display?: string | undefined;
|
|
38
34
|
loginHint?: string | undefined;
|
|
39
35
|
}): Promise<URL>;
|
|
40
|
-
validateAuthorizationCode({
|
|
41
|
-
code,
|
|
42
|
-
redirectURI,
|
|
43
|
-
codeVerifier
|
|
44
|
-
}: {
|
|
36
|
+
validateAuthorizationCode({ code, redirectURI, codeVerifier }: {
|
|
45
37
|
code: string;
|
|
46
38
|
redirectURI: string;
|
|
47
39
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
1
3
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
2
5
|
//#region src/social-providers/line.d.ts
|
|
3
6
|
interface LineIdTokenPayload {
|
|
4
7
|
iss: string;
|
|
@@ -33,13 +36,7 @@ interface LineOptions extends ProviderOptions<LineUserInfo | LineIdTokenPayload>
|
|
|
33
36
|
declare const line: (options: LineOptions) => {
|
|
34
37
|
id: "line";
|
|
35
38
|
name: string;
|
|
36
|
-
createAuthorizationURL({
|
|
37
|
-
state,
|
|
38
|
-
scopes,
|
|
39
|
-
codeVerifier,
|
|
40
|
-
redirectURI,
|
|
41
|
-
loginHint
|
|
42
|
-
}: {
|
|
39
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint }: {
|
|
43
40
|
state: string;
|
|
44
41
|
codeVerifier: string;
|
|
45
42
|
scopes?: string[] | undefined;
|
|
@@ -47,18 +44,14 @@ declare const line: (options: LineOptions) => {
|
|
|
47
44
|
display?: string | undefined;
|
|
48
45
|
loginHint?: string | undefined;
|
|
49
46
|
}): Promise<URL>;
|
|
50
|
-
validateAuthorizationCode: ({
|
|
51
|
-
code,
|
|
52
|
-
codeVerifier,
|
|
53
|
-
redirectURI
|
|
54
|
-
}: {
|
|
47
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
55
48
|
code: string;
|
|
56
49
|
redirectURI: string;
|
|
57
50
|
codeVerifier?: string | undefined;
|
|
58
51
|
deviceId?: string | undefined;
|
|
59
52
|
}) => Promise<OAuth2Tokens>;
|
|
60
53
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
61
|
-
verifyIdToken(token: string, nonce
|
|
54
|
+
verifyIdToken(token: string, nonce?: string, ctx?: GenericEndpointContext): Promise<boolean>;
|
|
62
55
|
getUserInfo(token: OAuth2Tokens & {
|
|
63
56
|
user?: {
|
|
64
57
|
name?: {
|
|
@@ -59,9 +59,9 @@ const line = (options) => {
|
|
|
59
59
|
tokenEndpoint
|
|
60
60
|
});
|
|
61
61
|
},
|
|
62
|
-
async verifyIdToken(token, nonce) {
|
|
62
|
+
async verifyIdToken(token, nonce, ctx) {
|
|
63
63
|
if (options.disableIdTokenSignIn) return false;
|
|
64
|
-
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
64
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce, ctx);
|
|
65
65
|
const body = new URLSearchParams();
|
|
66
66
|
body.set("id_token", token);
|
|
67
67
|
body.set("client_id", options.clientId);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/linear.d.ts
|
|
3
4
|
interface LinearUser {
|
|
4
5
|
id: string;
|
|
@@ -20,12 +21,7 @@ interface LinearOptions extends ProviderOptions<LinearUser> {
|
|
|
20
21
|
declare const linear: (options: LinearOptions) => {
|
|
21
22
|
id: "linear";
|
|
22
23
|
name: string;
|
|
23
|
-
createAuthorizationURL({
|
|
24
|
-
state,
|
|
25
|
-
scopes,
|
|
26
|
-
loginHint,
|
|
27
|
-
redirectURI
|
|
28
|
-
}: {
|
|
24
|
+
createAuthorizationURL({ state, scopes, loginHint, redirectURI }: {
|
|
29
25
|
state: string;
|
|
30
26
|
codeVerifier: string;
|
|
31
27
|
scopes?: string[] | undefined;
|
|
@@ -33,10 +29,7 @@ declare const linear: (options: LinearOptions) => {
|
|
|
33
29
|
display?: string | undefined;
|
|
34
30
|
loginHint?: string | undefined;
|
|
35
31
|
}): Promise<URL>;
|
|
36
|
-
validateAuthorizationCode: ({
|
|
37
|
-
code,
|
|
38
|
-
redirectURI
|
|
39
|
-
}: {
|
|
32
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
40
33
|
code: string;
|
|
41
34
|
redirectURI: string;
|
|
42
35
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/linkedin.d.ts
|
|
3
4
|
interface LinkedInProfile {
|
|
4
5
|
sub: string;
|
|
@@ -19,12 +20,7 @@ interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
|
|
|
19
20
|
declare const linkedin: (options: LinkedInOptions) => {
|
|
20
21
|
id: "linkedin";
|
|
21
22
|
name: string;
|
|
22
|
-
createAuthorizationURL: ({
|
|
23
|
-
state,
|
|
24
|
-
scopes,
|
|
25
|
-
redirectURI,
|
|
26
|
-
loginHint
|
|
27
|
-
}: {
|
|
23
|
+
createAuthorizationURL: ({ state, scopes, redirectURI, loginHint }: {
|
|
28
24
|
state: string;
|
|
29
25
|
codeVerifier: string;
|
|
30
26
|
scopes?: string[] | undefined;
|
|
@@ -32,10 +28,7 @@ declare const linkedin: (options: LinkedInOptions) => {
|
|
|
32
28
|
display?: string | undefined;
|
|
33
29
|
loginHint?: string | undefined;
|
|
34
30
|
}) => Promise<URL>;
|
|
35
|
-
validateAuthorizationCode: ({
|
|
36
|
-
code,
|
|
37
|
-
redirectURI
|
|
38
|
-
}: {
|
|
31
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
39
32
|
code: string;
|
|
40
33
|
redirectURI: string;
|
|
41
34
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
1
3
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
2
5
|
//#region src/social-providers/microsoft-entra-id.d.ts
|
|
3
6
|
/**
|
|
4
7
|
* @see [Microsoft Identity Platform - Optional claims reference](https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims-reference)
|
|
@@ -136,17 +139,13 @@ declare const microsoft: (options: MicrosoftOptions) => {
|
|
|
136
139
|
display?: string | undefined;
|
|
137
140
|
loginHint?: string | undefined;
|
|
138
141
|
}): Promise<URL>;
|
|
139
|
-
validateAuthorizationCode({
|
|
140
|
-
code,
|
|
141
|
-
codeVerifier,
|
|
142
|
-
redirectURI
|
|
143
|
-
}: {
|
|
142
|
+
validateAuthorizationCode({ code, codeVerifier, redirectURI }: {
|
|
144
143
|
code: string;
|
|
145
144
|
redirectURI: string;
|
|
146
145
|
codeVerifier?: string | undefined;
|
|
147
146
|
deviceId?: string | undefined;
|
|
148
147
|
}): Promise<OAuth2Tokens>;
|
|
149
|
-
verifyIdToken(token: string, nonce
|
|
148
|
+
verifyIdToken(token: string, nonce?: string, ctx?: GenericEndpointContext): Promise<boolean>;
|
|
150
149
|
getUserInfo(token: OAuth2Tokens & {
|
|
151
150
|
user?: {
|
|
152
151
|
name?: {
|
|
@@ -59,9 +59,9 @@ const microsoft = (options) => {
|
|
|
59
59
|
tokenEndpoint
|
|
60
60
|
});
|
|
61
61
|
},
|
|
62
|
-
async verifyIdToken(token, nonce) {
|
|
62
|
+
async verifyIdToken(token, nonce, ctx) {
|
|
63
63
|
if (options.disableIdTokenSignIn) return false;
|
|
64
|
-
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
64
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce, ctx);
|
|
65
65
|
try {
|
|
66
66
|
const { kid, alg: jwtAlg } = decodeProtectedHeader(token);
|
|
67
67
|
if (!kid || !jwtAlg) return false;
|
|
@@ -99,7 +99,8 @@ const microsoft = (options) => {
|
|
|
99
99
|
if (options.disableProfilePhoto || !context.response.ok) return;
|
|
100
100
|
try {
|
|
101
101
|
const pictureBuffer = await context.response.clone().arrayBuffer();
|
|
102
|
-
|
|
102
|
+
const pictureBase64 = base64.encode(pictureBuffer);
|
|
103
|
+
user.picture = `data:image/jpeg;base64, ${pictureBase64}`;
|
|
103
104
|
} catch (e) {
|
|
104
105
|
logger.error(e && typeof e === "object" && "name" in e ? e.name : "", e);
|
|
105
106
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/naver.d.ts
|
|
3
4
|
interface NaverProfile {
|
|
4
5
|
/** API response result code */
|
|
@@ -6,15 +7,25 @@ interface NaverProfile {
|
|
|
6
7
|
/** API response message */
|
|
7
8
|
message: string;
|
|
8
9
|
response: {
|
|
9
|
-
/** Unique Naver user identifier */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
/** Unique Naver user identifier */
|
|
11
|
+
id: string;
|
|
12
|
+
/** User nickname */
|
|
13
|
+
nickname: string;
|
|
14
|
+
/** User real name */
|
|
15
|
+
name: string;
|
|
16
|
+
/** User email address */
|
|
17
|
+
email: string;
|
|
18
|
+
/** Gender (F: female, M: male, U: unknown) */
|
|
19
|
+
gender: string;
|
|
20
|
+
/** Age range */
|
|
21
|
+
age: string;
|
|
22
|
+
/** Birthday (MM-DD format) */
|
|
23
|
+
birthday: string;
|
|
24
|
+
/** Birth year */
|
|
25
|
+
birthyear: string;
|
|
26
|
+
/** Profile image URL */
|
|
27
|
+
profile_image: string;
|
|
28
|
+
/** Mobile phone number */
|
|
18
29
|
mobile: string;
|
|
19
30
|
};
|
|
20
31
|
}
|
|
@@ -24,11 +35,7 @@ interface NaverOptions extends ProviderOptions<NaverProfile> {
|
|
|
24
35
|
declare const naver: (options: NaverOptions) => {
|
|
25
36
|
id: "naver";
|
|
26
37
|
name: string;
|
|
27
|
-
createAuthorizationURL({
|
|
28
|
-
state,
|
|
29
|
-
scopes,
|
|
30
|
-
redirectURI
|
|
31
|
-
}: {
|
|
38
|
+
createAuthorizationURL({ state, scopes, redirectURI }: {
|
|
32
39
|
state: string;
|
|
33
40
|
codeVerifier: string;
|
|
34
41
|
scopes?: string[] | undefined;
|
|
@@ -36,10 +43,7 @@ declare const naver: (options: NaverOptions) => {
|
|
|
36
43
|
display?: string | undefined;
|
|
37
44
|
loginHint?: string | undefined;
|
|
38
45
|
}): Promise<URL>;
|
|
39
|
-
validateAuthorizationCode: ({
|
|
40
|
-
code,
|
|
41
|
-
redirectURI
|
|
42
|
-
}: {
|
|
46
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
43
47
|
code: string;
|
|
44
48
|
redirectURI: string;
|
|
45
49
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/notion.d.ts
|
|
3
4
|
interface NotionProfile {
|
|
4
5
|
object: "user";
|
|
@@ -16,12 +17,7 @@ interface NotionOptions extends ProviderOptions<NotionProfile> {
|
|
|
16
17
|
declare const notion: (options: NotionOptions) => {
|
|
17
18
|
id: "notion";
|
|
18
19
|
name: string;
|
|
19
|
-
createAuthorizationURL({
|
|
20
|
-
state,
|
|
21
|
-
scopes,
|
|
22
|
-
loginHint,
|
|
23
|
-
redirectURI
|
|
24
|
-
}: {
|
|
20
|
+
createAuthorizationURL({ state, scopes, loginHint, redirectURI }: {
|
|
25
21
|
state: string;
|
|
26
22
|
codeVerifier: string;
|
|
27
23
|
scopes?: string[] | undefined;
|
|
@@ -29,10 +25,7 @@ declare const notion: (options: NotionOptions) => {
|
|
|
29
25
|
display?: string | undefined;
|
|
30
26
|
loginHint?: string | undefined;
|
|
31
27
|
}): Promise<URL>;
|
|
32
|
-
validateAuthorizationCode: ({
|
|
33
|
-
code,
|
|
34
|
-
redirectURI
|
|
35
|
-
}: {
|
|
28
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
36
29
|
code: string;
|
|
37
30
|
redirectURI: string;
|
|
38
31
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,13 +22,7 @@ interface PaybinOptions extends ProviderOptions<PaybinProfile> {
|
|
|
21
22
|
declare const paybin: (options: PaybinOptions) => {
|
|
22
23
|
id: "paybin";
|
|
23
24
|
name: string;
|
|
24
|
-
createAuthorizationURL({
|
|
25
|
-
state,
|
|
26
|
-
scopes,
|
|
27
|
-
codeVerifier,
|
|
28
|
-
redirectURI,
|
|
29
|
-
loginHint
|
|
30
|
-
}: {
|
|
25
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint }: {
|
|
31
26
|
state: string;
|
|
32
27
|
codeVerifier: string;
|
|
33
28
|
scopes?: string[] | undefined;
|
|
@@ -35,11 +30,7 @@ declare const paybin: (options: PaybinOptions) => {
|
|
|
35
30
|
display?: string | undefined;
|
|
36
31
|
loginHint?: string | undefined;
|
|
37
32
|
}): Promise<URL>;
|
|
38
|
-
validateAuthorizationCode: ({
|
|
39
|
-
code,
|
|
40
|
-
codeVerifier,
|
|
41
|
-
redirectURI
|
|
42
|
-
}: {
|
|
33
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
43
34
|
code: string;
|
|
44
35
|
redirectURI: string;
|
|
45
36
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
1
3
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
2
5
|
//#region src/social-providers/paypal.d.ts
|
|
3
6
|
interface PayPalProfile {
|
|
4
7
|
sub?: string | undefined;
|
|
@@ -52,11 +55,7 @@ interface PayPalOptions extends ProviderOptions<PayPalProfile> {
|
|
|
52
55
|
declare const paypal: (options: PayPalOptions) => {
|
|
53
56
|
id: "paypal";
|
|
54
57
|
name: string;
|
|
55
|
-
createAuthorizationURL({
|
|
56
|
-
state,
|
|
57
|
-
codeVerifier,
|
|
58
|
-
redirectURI
|
|
59
|
-
}: {
|
|
58
|
+
createAuthorizationURL({ state, codeVerifier, redirectURI }: {
|
|
60
59
|
state: string;
|
|
61
60
|
codeVerifier: string;
|
|
62
61
|
scopes?: string[] | undefined;
|
|
@@ -64,10 +63,7 @@ declare const paypal: (options: PayPalOptions) => {
|
|
|
64
63
|
display?: string | undefined;
|
|
65
64
|
loginHint?: string | undefined;
|
|
66
65
|
}): Promise<URL>;
|
|
67
|
-
validateAuthorizationCode: ({
|
|
68
|
-
code,
|
|
69
|
-
redirectURI
|
|
70
|
-
}: {
|
|
66
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
71
67
|
code: string;
|
|
72
68
|
redirectURI: string;
|
|
73
69
|
codeVerifier?: string | undefined;
|
|
@@ -83,7 +79,7 @@ declare const paypal: (options: PayPalOptions) => {
|
|
|
83
79
|
refreshToken: any;
|
|
84
80
|
accessTokenExpiresAt: Date | undefined;
|
|
85
81
|
}>);
|
|
86
|
-
verifyIdToken(token: string, nonce
|
|
82
|
+
verifyIdToken(token: string, nonce?: string, ctx?: GenericEndpointContext): Promise<boolean>;
|
|
87
83
|
getUserInfo(token: OAuth2Tokens & {
|
|
88
84
|
user?: {
|
|
89
85
|
name?: {
|
|
@@ -105,9 +105,9 @@ const paypal = (options) => {
|
|
|
105
105
|
throw new BetterAuthError("FAILED_TO_REFRESH_ACCESS_TOKEN");
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
|
-
async verifyIdToken(token, nonce) {
|
|
108
|
+
async verifyIdToken(token, nonce, ctx) {
|
|
109
109
|
if (options.disableIdTokenSignIn) return false;
|
|
110
|
-
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
110
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce, ctx);
|
|
111
111
|
try {
|
|
112
112
|
const { kid, alg: jwtAlg } = decodeProtectedHeader(token);
|
|
113
113
|
if (!jwtAlg) return false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,12 +26,7 @@ interface PolarOptions extends ProviderOptions<PolarProfile> {}
|
|
|
25
26
|
declare const polar: (options: PolarOptions) => {
|
|
26
27
|
id: "polar";
|
|
27
28
|
name: string;
|
|
28
|
-
createAuthorizationURL({
|
|
29
|
-
state,
|
|
30
|
-
scopes,
|
|
31
|
-
codeVerifier,
|
|
32
|
-
redirectURI
|
|
33
|
-
}: {
|
|
29
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
34
30
|
state: string;
|
|
35
31
|
codeVerifier: string;
|
|
36
32
|
scopes?: string[] | undefined;
|
|
@@ -38,11 +34,7 @@ declare const polar: (options: PolarOptions) => {
|
|
|
38
34
|
display?: string | undefined;
|
|
39
35
|
loginHint?: 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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,12 +17,7 @@ interface RailwayOptions extends ProviderOptions<RailwayProfile> {
|
|
|
16
17
|
declare const railway: (options: RailwayOptions) => {
|
|
17
18
|
id: "railway";
|
|
18
19
|
name: string;
|
|
19
|
-
createAuthorizationURL({
|
|
20
|
-
state,
|
|
21
|
-
scopes,
|
|
22
|
-
codeVerifier,
|
|
23
|
-
redirectURI
|
|
24
|
-
}: {
|
|
20
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
25
21
|
state: string;
|
|
26
22
|
codeVerifier: string;
|
|
27
23
|
scopes?: string[] | undefined;
|
|
@@ -29,11 +25,7 @@ declare const railway: (options: RailwayOptions) => {
|
|
|
29
25
|
display?: string | undefined;
|
|
30
26
|
loginHint?: string | undefined;
|
|
31
27
|
}): Promise<URL>;
|
|
32
|
-
validateAuthorizationCode: ({
|
|
33
|
-
code,
|
|
34
|
-
codeVerifier,
|
|
35
|
-
redirectURI
|
|
36
|
-
}: {
|
|
28
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
37
29
|
code: string;
|
|
38
30
|
redirectURI: string;
|
|
39
31
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,11 +16,7 @@ interface RedditOptions extends ProviderOptions<RedditProfile> {
|
|
|
15
16
|
declare const reddit: (options: RedditOptions) => {
|
|
16
17
|
id: "reddit";
|
|
17
18
|
name: string;
|
|
18
|
-
createAuthorizationURL({
|
|
19
|
-
state,
|
|
20
|
-
scopes,
|
|
21
|
-
redirectURI
|
|
22
|
-
}: {
|
|
19
|
+
createAuthorizationURL({ state, scopes, redirectURI }: {
|
|
23
20
|
state: string;
|
|
24
21
|
codeVerifier: string;
|
|
25
22
|
scopes?: string[] | undefined;
|
|
@@ -27,10 +24,7 @@ declare const reddit: (options: RedditOptions) => {
|
|
|
27
24
|
display?: string | undefined;
|
|
28
25
|
loginHint?: string | undefined;
|
|
29
26
|
}): Promise<URL>;
|
|
30
|
-
validateAuthorizationCode: ({
|
|
31
|
-
code,
|
|
32
|
-
redirectURI
|
|
33
|
-
}: {
|
|
27
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
34
28
|
code: string;
|
|
35
29
|
redirectURI: string;
|
|
36
30
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,11 +24,7 @@ interface RobloxOptions extends ProviderOptions<RobloxProfile> {
|
|
|
23
24
|
declare const roblox: (options: RobloxOptions) => {
|
|
24
25
|
id: "roblox";
|
|
25
26
|
name: string;
|
|
26
|
-
createAuthorizationURL({
|
|
27
|
-
state,
|
|
28
|
-
scopes,
|
|
29
|
-
redirectURI
|
|
30
|
-
}: {
|
|
27
|
+
createAuthorizationURL({ state, scopes, redirectURI }: {
|
|
31
28
|
state: string;
|
|
32
29
|
codeVerifier: string;
|
|
33
30
|
scopes?: string[] | undefined;
|
|
@@ -35,10 +32,7 @@ declare const roblox: (options: RobloxOptions) => {
|
|
|
35
32
|
display?: string | undefined;
|
|
36
33
|
loginHint?: string | undefined;
|
|
37
34
|
}): URL;
|
|
38
|
-
validateAuthorizationCode: ({
|
|
39
|
-
code,
|
|
40
|
-
redirectURI
|
|
41
|
-
}: {
|
|
35
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
42
36
|
code: string;
|
|
43
37
|
redirectURI: string;
|
|
44
38
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,12 +31,7 @@ interface SalesforceOptions extends ProviderOptions<SalesforceProfile> {
|
|
|
30
31
|
declare const salesforce: (options: SalesforceOptions) => {
|
|
31
32
|
id: "salesforce";
|
|
32
33
|
name: string;
|
|
33
|
-
createAuthorizationURL({
|
|
34
|
-
state,
|
|
35
|
-
scopes,
|
|
36
|
-
codeVerifier,
|
|
37
|
-
redirectURI
|
|
38
|
-
}: {
|
|
34
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
39
35
|
state: string;
|
|
40
36
|
codeVerifier: string;
|
|
41
37
|
scopes?: string[] | undefined;
|
|
@@ -43,11 +39,7 @@ declare const salesforce: (options: SalesforceOptions) => {
|
|
|
43
39
|
display?: string | undefined;
|
|
44
40
|
loginHint?: string | undefined;
|
|
45
41
|
}): Promise<URL>;
|
|
46
|
-
validateAuthorizationCode: ({
|
|
47
|
-
code,
|
|
48
|
-
codeVerifier,
|
|
49
|
-
redirectURI
|
|
50
|
-
}: {
|
|
42
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
51
43
|
code: string;
|
|
52
44
|
redirectURI: string;
|
|
53
45
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,11 +37,7 @@ interface SlackOptions extends ProviderOptions<SlackProfile> {
|
|
|
36
37
|
declare const slack: (options: SlackOptions) => {
|
|
37
38
|
id: "slack";
|
|
38
39
|
name: string;
|
|
39
|
-
createAuthorizationURL({
|
|
40
|
-
state,
|
|
41
|
-
scopes,
|
|
42
|
-
redirectURI
|
|
43
|
-
}: {
|
|
40
|
+
createAuthorizationURL({ state, scopes, redirectURI }: {
|
|
44
41
|
state: string;
|
|
45
42
|
codeVerifier: string;
|
|
46
43
|
scopes?: string[] | undefined;
|
|
@@ -48,10 +45,7 @@ declare const slack: (options: SlackOptions) => {
|
|
|
48
45
|
display?: string | undefined;
|
|
49
46
|
loginHint?: string | undefined;
|
|
50
47
|
}): URL;
|
|
51
|
-
validateAuthorizationCode: ({
|
|
52
|
-
code,
|
|
53
|
-
redirectURI
|
|
54
|
-
}: {
|
|
48
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
55
49
|
code: string;
|
|
56
50
|
redirectURI: string;
|
|
57
51
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, 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,12 +15,7 @@ interface SpotifyOptions extends ProviderOptions<SpotifyProfile> {
|
|
|
14
15
|
declare const spotify: (options: SpotifyOptions) => {
|
|
15
16
|
id: "spotify";
|
|
16
17
|
name: string;
|
|
17
|
-
createAuthorizationURL({
|
|
18
|
-
state,
|
|
19
|
-
scopes,
|
|
20
|
-
codeVerifier,
|
|
21
|
-
redirectURI
|
|
22
|
-
}: {
|
|
18
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
23
19
|
state: string;
|
|
24
20
|
codeVerifier: string;
|
|
25
21
|
scopes?: string[] | undefined;
|
|
@@ -27,11 +23,7 @@ declare const spotify: (options: SpotifyOptions) => {
|
|
|
27
23
|
display?: string | undefined;
|
|
28
24
|
loginHint?: string | undefined;
|
|
29
25
|
}): Promise<URL>;
|
|
30
|
-
validateAuthorizationCode: ({
|
|
31
|
-
code,
|
|
32
|
-
codeVerifier,
|
|
33
|
-
redirectURI
|
|
34
|
-
}: {
|
|
26
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
35
27
|
code: string;
|
|
36
28
|
redirectURI: string;
|
|
37
29
|
codeVerifier?: string | undefined;
|