@aura-stack/auth 0.1.0-rc.9 → 0.2.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.
- package/dist/@types/index.cjs +15 -15
- package/dist/@types/index.d.ts +6 -31
- package/dist/@types/index.js +1 -1
- package/dist/@types/router.d.cjs +1 -1
- package/dist/@types/router.d.d.ts +6 -7
- package/dist/@types/utility.cjs +15 -15
- package/dist/@types/utility.d.ts +4 -8
- package/dist/@types/utility.js +1 -1
- package/dist/actions/callback/access-token.cjs +159 -149
- package/dist/actions/callback/access-token.d.ts +14 -20
- package/dist/actions/callback/access-token.js +9 -4
- package/dist/actions/callback/callback.cjs +371 -484
- package/dist/actions/callback/callback.d.ts +9 -12
- package/dist/actions/callback/callback.js +15 -12
- package/dist/actions/callback/userinfo.cjs +149 -139
- package/dist/actions/callback/userinfo.d.ts +8 -9
- package/dist/actions/callback/userinfo.js +11 -6
- package/dist/actions/csrfToken/csrfToken.cjs +112 -190
- package/dist/actions/csrfToken/csrfToken.d.ts +3 -3
- package/dist/actions/csrfToken/csrfToken.js +12 -8
- package/dist/actions/index.cjs +623 -807
- package/dist/actions/index.d.ts +12 -13
- package/dist/actions/index.js +33 -18
- package/dist/actions/session/session.cjs +86 -176
- package/dist/actions/session/session.d.ts +3 -3
- package/dist/actions/session/session.js +10 -7
- package/dist/actions/signIn/authorization.cjs +248 -257
- package/dist/actions/signIn/authorization.d.ts +11 -18
- package/dist/actions/signIn/authorization.js +16 -6
- package/dist/actions/signIn/signIn.cjs +302 -451
- package/dist/actions/signIn/signIn.d.ts +9 -10
- package/dist/actions/signIn/signIn.js +12 -10
- package/dist/actions/signOut/signOut.cjs +299 -468
- package/dist/actions/signOut/signOut.d.ts +3 -3
- package/dist/actions/signOut/signOut.js +14 -11
- package/dist/assert.cjs +40 -36
- package/dist/assert.d.ts +12 -4
- package/dist/assert.js +12 -2
- package/dist/chunk-2RXNXMCZ.js +55 -0
- package/dist/chunk-42XB3YCW.js +19 -17
- package/dist/chunk-4V4JNXVF.js +55 -0
- package/dist/chunk-6R2YZ4AC.js +22 -0
- package/dist/chunk-7H3OR6UU.js +81 -0
- package/dist/chunk-CXLATHS5.js +143 -0
- package/dist/chunk-E3OXBRYF.js +19 -17
- package/dist/chunk-EIL2FPSS.js +22 -0
- package/dist/chunk-FIPU4MLT.js +18 -16
- package/dist/chunk-FKRDCWBF.js +19 -17
- package/dist/chunk-IKHPGFCW.js +11 -9
- package/dist/chunk-IMICRJ5U.js +197 -0
- package/dist/chunk-IUYZQTJV.js +30 -0
- package/dist/chunk-KRNOMBXQ.js +19 -17
- package/dist/chunk-N2APGLXA.js +71 -0
- package/dist/chunk-NEVKX6K2.js +70 -0
- package/dist/chunk-PTJUYB33.js +33 -0
- package/dist/chunk-QDO2KSRJ.js +35 -0
- package/dist/chunk-QEZL7EYN.js +96 -0
- package/dist/chunk-RRLIF4PQ.js +55 -0
- package/dist/chunk-STHEPPUZ.js +8 -6
- package/dist/chunk-TLE4PXY3.js +39 -0
- package/dist/chunk-UEH3LVON.js +97 -0
- package/dist/chunk-WD7AUHQ5.js +79 -0
- package/dist/chunk-ZLR3LI6X.js +55 -0
- package/dist/cookie.cjs +222 -187
- package/dist/cookie.d.ts +38 -76
- package/dist/cookie.js +27 -34
- package/dist/errors.cjs +85 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.js +18 -0
- package/dist/headers.cjs +28 -28
- package/dist/headers.d.ts +2 -2
- package/dist/headers.js +6 -2
- package/dist/{index-DpfbvTZ_.d.ts → index-EqsoyjrF.d.ts} +351 -318
- package/dist/index.cjs +1006 -1001
- package/dist/index.d.ts +9 -31
- package/dist/index.js +82 -51
- package/dist/jose.cjs +74 -66
- package/dist/jose.d.ts +11 -8
- package/dist/jose.js +10 -5
- package/dist/oauth/bitbucket.cjs +38 -38
- package/dist/oauth/bitbucket.d.ts +6 -7
- package/dist/oauth/bitbucket.js +6 -2
- package/dist/oauth/discord.cjs +47 -48
- package/dist/oauth/discord.d.ts +6 -7
- package/dist/oauth/discord.js +6 -2
- package/dist/oauth/figma.cjs +39 -39
- package/dist/oauth/figma.d.ts +6 -7
- package/dist/oauth/figma.js +6 -2
- package/dist/oauth/github.cjs +31 -31
- package/dist/oauth/github.d.ts +6 -7
- package/dist/oauth/github.js +6 -2
- package/dist/oauth/gitlab.cjs +39 -39
- package/dist/oauth/gitlab.d.ts +6 -7
- package/dist/oauth/gitlab.js +6 -2
- package/dist/oauth/index.cjs +306 -180
- package/dist/oauth/index.d.ts +6 -26
- package/dist/oauth/index.js +43 -9
- package/dist/oauth/spotify.cjs +39 -39
- package/dist/oauth/spotify.d.ts +6 -7
- package/dist/oauth/spotify.js +6 -2
- package/dist/oauth/strava.cjs +46 -0
- package/dist/oauth/strava.d.ts +6 -0
- package/dist/oauth/strava.js +6 -0
- package/dist/oauth/x.cjs +39 -39
- package/dist/oauth/x.d.ts +6 -7
- package/dist/oauth/x.js +6 -2
- package/dist/schemas.cjs +97 -91
- package/dist/schemas.d.ts +96 -126
- package/dist/schemas.js +20 -18
- package/dist/secure.cjs +106 -101
- package/dist/secure.d.ts +16 -17
- package/dist/secure.js +19 -4
- package/dist/utils.cjs +197 -135
- package/dist/utils.d.ts +20 -26
- package/dist/utils.js +25 -21
- package/package.json +5 -6
- package/dist/chunk-256KIVJL.js +0 -110
- package/dist/chunk-6SM22VVJ.js +0 -15
- package/dist/chunk-CAKJT3KS.js +0 -77
- package/dist/chunk-EBPE35JT.js +0 -29
- package/dist/chunk-FJUDBLCP.js +0 -52
- package/dist/chunk-GZU3RBTB.js +0 -51
- package/dist/chunk-HGJ4TXY4.js +0 -105
- package/dist/chunk-HMRKN75I.js +0 -74
- package/dist/chunk-JAPMIE6S.js +0 -8
- package/dist/chunk-LLR722CL.js +0 -75
- package/dist/chunk-RLT4RFKV.js +0 -36
- package/dist/chunk-SJPDVKUS.js +0 -93
- package/dist/chunk-SMQO5WD7.js +0 -20
- package/dist/chunk-UJJ7R56J.js +0 -42
- package/dist/chunk-UTDLUEEG.js +0 -25
- package/dist/chunk-VFTYH33W.js +0 -44
- package/dist/chunk-XXJKNKGQ.js +0 -27
- package/dist/chunk-ZV4BH47P.js +0 -156
- package/dist/error.cjs +0 -88
- package/dist/error.d.ts +0 -62
- package/dist/error.js +0 -9
- package/dist/response.cjs +0 -34
- package/dist/response.d.ts +0 -10
- package/dist/response.js +0 -2
package/dist/@types/index.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var __defProp = Object.defineProperty
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
15
|
|
|
16
16
|
// src/@types/index.ts
|
|
17
|
-
var types_exports = {}
|
|
18
|
-
module.exports = __toCommonJS(types_exports)
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
y as AccessTokenError,
|
|
8
|
-
c as AuthConfig,
|
|
9
|
-
d as AuthInstance,
|
|
10
|
-
A as AuthRuntimeConfig,
|
|
11
|
-
w as AuthorizationError,
|
|
12
|
-
C as CookieConfig,
|
|
13
|
-
a as CookieConfigInternal,
|
|
14
|
-
b as CookieName,
|
|
15
|
-
u as CookieStrategyOptions,
|
|
16
|
-
E as ErrorType,
|
|
17
|
-
H as HostCookie,
|
|
18
|
-
q as JWTStandardClaims,
|
|
19
|
-
J as JoseInstance,
|
|
20
|
-
v as OAuthError,
|
|
21
|
-
O as OAuthProvider,
|
|
22
|
-
e as OAuthProviderConfig,
|
|
23
|
-
f as OAuthProviderCredentials,
|
|
24
|
-
R as RouterGlobalContext,
|
|
25
|
-
r as SecureCookie,
|
|
26
|
-
S as Session,
|
|
27
|
-
t as StandardCookie,
|
|
28
|
-
T as TokenRevocationError,
|
|
29
|
-
U as User,
|
|
30
|
-
} from "../index-DpfbvTZ_.js"
|
|
31
|
-
import "zod/v4/core"
|
|
1
|
+
import 'zod/v4';
|
|
2
|
+
import '../schemas.js';
|
|
3
|
+
import '@aura-stack/router/cookie';
|
|
4
|
+
import '@aura-stack/jose/jose';
|
|
5
|
+
export { i as APIErrorMap, V as AccessTokenError, d as AuthConfig, e as AuthInstance, b as AuthInternalErrorCode, A as AuthRuntimeConfig, c as AuthSecurityErrorCode, T as AuthorizationError, C as CookieConfig, P as CookieName, a as CookieStoreConfig, M as CookieStrategyAttributes, E as ErrorType, K as HostCookie, J as JWTPayloadWithToken, z as JWTStandardClaims, f as JoseInstance, Y as OAuthEnv, Q as OAuthError, O as OAuthProvider, g as OAuthProviderConfig, h as OAuthProviderCredentials, R as RouterGlobalContext, H as SecureCookie, S as Session, L as StandardCookie, W as TokenRevocationError, U as User } from '../index-EqsoyjrF.js';
|
|
6
|
+
export { LiteralUnion, Prettify } from './utility.js';
|
package/dist/@types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../chunk-PG7UYFG5.js"
|
|
1
|
+
import "../chunk-PG7UYFG5.js";
|
package/dist/@types/router.d.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { R as RouterGlobalContext } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import "./utility.js"
|
|
1
|
+
import { R as RouterGlobalContext } from '../index-EqsoyjrF.js';
|
|
2
|
+
import 'zod/v4';
|
|
3
|
+
import '../schemas.js';
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
6
|
+
import './utility.js';
|
|
8
7
|
|
|
9
8
|
declare module "@aura-stack/router" {
|
|
10
9
|
interface GlobalContext extends RouterGlobalContext {}
|
package/dist/@types/utility.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var __defProp = Object.defineProperty
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
15
|
|
|
16
16
|
// src/@types/utility.ts
|
|
17
|
-
var utility_exports = {}
|
|
18
|
-
module.exports = __toCommonJS(utility_exports)
|
|
17
|
+
var utility_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(utility_exports);
|
package/dist/@types/utility.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
type Prettify<T> = {
|
|
2
|
-
[K in keyof T]: T[K]
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
type LiteralUnion<T extends U, U = string> = (T | (U & Record<never, never>)) & {
|
|
7
|
-
__aura_auth_literal_union_brand?: never
|
|
8
|
-
}
|
|
2
|
+
[K in keyof T]: T[K];
|
|
3
|
+
};
|
|
4
|
+
type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
|
|
9
5
|
|
|
10
|
-
export type { LiteralUnion, Prettify }
|
|
6
|
+
export type { LiteralUnion, Prettify };
|
package/dist/@types/utility.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../chunk-PG7UYFG5.js"
|
|
1
|
+
import "../chunk-PG7UYFG5.js";
|
|
@@ -1,170 +1,180 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var __defProp = Object.defineProperty
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __export = (target, all) => {
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
9
10
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
19
|
|
|
19
20
|
// src/actions/callback/access-token.ts
|
|
20
|
-
var access_token_exports = {}
|
|
21
|
+
var access_token_exports = {};
|
|
21
22
|
__export(access_token_exports, {
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
module.exports = __toCommonJS(access_token_exports)
|
|
23
|
+
createAccessToken: () => createAccessToken
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(access_token_exports);
|
|
25
26
|
|
|
26
|
-
// src/
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
27
|
+
// src/utils.ts
|
|
28
|
+
var import_router = require("@aura-stack/router");
|
|
29
|
+
|
|
30
|
+
// src/errors.ts
|
|
31
|
+
var OAuthProtocolError = class extends Error {
|
|
32
|
+
type = "OAUTH_PROTOCOL_ERROR";
|
|
33
|
+
error;
|
|
34
|
+
errorURI;
|
|
35
|
+
constructor(error, description, errorURI, options2) {
|
|
36
|
+
super(description, options2);
|
|
37
|
+
this.error = error;
|
|
38
|
+
this.errorURI = errorURI;
|
|
39
|
+
this.name = new.target.name;
|
|
40
|
+
Error.captureStackTrace(this, new.target);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var AuthInternalError = class extends Error {
|
|
44
|
+
type = "AUTH_INTERNAL_ERROR";
|
|
45
|
+
code;
|
|
46
|
+
constructor(code, message, options2) {
|
|
47
|
+
super(message, options2);
|
|
48
|
+
this.code = code;
|
|
49
|
+
this.name = new.target.name;
|
|
50
|
+
Error.captureStackTrace(this, new.target);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/utils.ts
|
|
55
|
+
var formatZodError = (error) => {
|
|
56
|
+
if (!error.issues || error.issues.length === 0) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
return error.issues.reduce((previous, issue) => {
|
|
60
|
+
const key = issue.path.join(".");
|
|
61
|
+
return {
|
|
62
|
+
...previous,
|
|
63
|
+
[key]: {
|
|
64
|
+
code: issue.code,
|
|
65
|
+
message: issue.message
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}, {});
|
|
69
|
+
};
|
|
64
70
|
|
|
65
71
|
// src/schemas.ts
|
|
66
|
-
var import_v4 = require("zod/v4")
|
|
72
|
+
var import_v4 = require("zod/v4");
|
|
67
73
|
var OAuthProviderConfigSchema = (0, import_v4.object)({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})
|
|
74
|
+
authorizeURL: (0, import_v4.httpUrl)(),
|
|
75
|
+
accessToken: (0, import_v4.httpUrl)(),
|
|
76
|
+
scope: (0, import_v4.string)().optional(),
|
|
77
|
+
userInfo: (0, import_v4.httpUrl)(),
|
|
78
|
+
responseType: (0, import_v4.enum)(["code", "token", "id_token"]),
|
|
79
|
+
clientId: (0, import_v4.string)(),
|
|
80
|
+
clientSecret: (0, import_v4.string)()
|
|
81
|
+
});
|
|
76
82
|
var OAuthAuthorization = OAuthProviderConfigSchema.extend({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
83
|
+
redirectURI: (0, import_v4.string)(),
|
|
84
|
+
state: (0, import_v4.string)(),
|
|
85
|
+
codeChallenge: (0, import_v4.string)(),
|
|
86
|
+
codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
|
|
87
|
+
});
|
|
82
88
|
var OAuthAuthorizationResponse = (0, import_v4.object)({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
89
|
+
state: (0, import_v4.string)("Missing state parameter in the OAuth authorization response."),
|
|
90
|
+
code: (0, import_v4.string)("Missing code parameter in the OAuth authorization response.")
|
|
91
|
+
});
|
|
86
92
|
var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})
|
|
93
|
+
error: (0, import_v4.enum)([
|
|
94
|
+
"invalid_request",
|
|
95
|
+
"unauthorized_client",
|
|
96
|
+
"access_denied",
|
|
97
|
+
"unsupported_response_type",
|
|
98
|
+
"invalid_scope",
|
|
99
|
+
"server_error",
|
|
100
|
+
"temporarily_unavailable"
|
|
101
|
+
]),
|
|
102
|
+
error_description: (0, import_v4.string)().optional(),
|
|
103
|
+
error_uri: (0, import_v4.string)().optional(),
|
|
104
|
+
state: (0, import_v4.string)()
|
|
105
|
+
});
|
|
100
106
|
var OAuthAccessToken = OAuthProviderConfigSchema.extend({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})
|
|
107
|
+
redirectURI: (0, import_v4.string)(),
|
|
108
|
+
code: (0, import_v4.string)(),
|
|
109
|
+
codeVerifier: (0, import_v4.string)().min(43).max(128)
|
|
110
|
+
});
|
|
105
111
|
var OAuthAccessTokenResponse = (0, import_v4.object)({
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})
|
|
112
|
+
access_token: (0, import_v4.string)(),
|
|
113
|
+
token_type: (0, import_v4.string)(),
|
|
114
|
+
expires_in: (0, import_v4.number)().optional(),
|
|
115
|
+
refresh_token: (0, import_v4.string)().optional(),
|
|
116
|
+
scope: (0, import_v4.string)().optional()
|
|
117
|
+
});
|
|
112
118
|
var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
119
|
+
error: (0, import_v4.enum)([
|
|
120
|
+
"invalid_request",
|
|
121
|
+
"invalid_client",
|
|
122
|
+
"invalid_grant",
|
|
123
|
+
"unauthorized_client",
|
|
124
|
+
"unsupported_grant_type",
|
|
125
|
+
"invalid_scope"
|
|
126
|
+
]),
|
|
127
|
+
error_description: (0, import_v4.string)().optional(),
|
|
128
|
+
error_uri: (0, import_v4.string)().optional()
|
|
129
|
+
});
|
|
124
130
|
var OAuthErrorResponse = (0, import_v4.object)({
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
131
|
+
error: (0, import_v4.string)(),
|
|
132
|
+
error_description: (0, import_v4.string)().optional()
|
|
133
|
+
});
|
|
134
|
+
var OAuthEnvSchema = (0, import_v4.object)({
|
|
135
|
+
clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
|
|
136
|
+
clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
|
|
137
|
+
});
|
|
128
138
|
|
|
129
139
|
// src/actions/callback/access-token.ts
|
|
130
140
|
var createAccessToken = async (oauthConfig, redirectURI, code, codeVerifier) => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return token.data
|
|
162
|
-
} catch (error) {
|
|
163
|
-
throw throwAuthError(error, "Failed to create access token")
|
|
141
|
+
const parsed = OAuthAccessToken.safeParse({ ...oauthConfig, redirectURI, code, codeVerifier });
|
|
142
|
+
if (!parsed.success) {
|
|
143
|
+
const msg = JSON.stringify(formatZodError(parsed.error), null, 2);
|
|
144
|
+
throw new AuthInternalError("INVALID_OAUTH_CONFIGURATION", msg);
|
|
145
|
+
}
|
|
146
|
+
const { accessToken, clientId, clientSecret, code: codeParsed, redirectURI: redirectParsed } = parsed.data;
|
|
147
|
+
try {
|
|
148
|
+
const response = await fetch(accessToken, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
headers: {
|
|
151
|
+
Accept: "application/json",
|
|
152
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
153
|
+
},
|
|
154
|
+
body: new URLSearchParams({
|
|
155
|
+
client_id: clientId,
|
|
156
|
+
client_secret: clientSecret,
|
|
157
|
+
code: codeParsed,
|
|
158
|
+
redirect_uri: redirectParsed,
|
|
159
|
+
grant_type: "authorization_code",
|
|
160
|
+
code_verifier: codeVerifier
|
|
161
|
+
}).toString()
|
|
162
|
+
});
|
|
163
|
+
const json = await response.json();
|
|
164
|
+
const token = OAuthAccessTokenResponse.safeParse(json);
|
|
165
|
+
if (!token.success) {
|
|
166
|
+
const { success, data } = OAuthAccessTokenErrorResponse.safeParse(json);
|
|
167
|
+
if (!success) {
|
|
168
|
+
throw new OAuthProtocolError("INVALID_REQUEST", "Invalid access token response format");
|
|
169
|
+
}
|
|
170
|
+
throw new OAuthProtocolError(data.error, data?.error_description ?? "Failed to retrieve access token");
|
|
164
171
|
}
|
|
165
|
-
|
|
172
|
+
return token.data;
|
|
173
|
+
} catch (error) {
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
166
177
|
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
-
0 &&
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
})
|
|
178
|
+
0 && (module.exports = {
|
|
179
|
+
createAccessToken
|
|
180
|
+
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import "../../@types/utility.js"
|
|
1
|
+
import { h as OAuthProviderCredentials } from '../../index-EqsoyjrF.js';
|
|
2
|
+
import 'zod/v4';
|
|
3
|
+
import '../../schemas.js';
|
|
4
|
+
import '@aura-stack/router/cookie';
|
|
5
|
+
import '@aura-stack/jose/jose';
|
|
6
|
+
import '../../@types/utility.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Make a request to the OAuth provider to the token endpoint to exchange the authorization code provided
|
|
@@ -17,17 +16,12 @@ import "../../@types/utility.js"
|
|
|
17
16
|
* @param code - The authorization code received from the OAuth server
|
|
18
17
|
* @returns The access token response from the OAuth server
|
|
19
18
|
*/
|
|
20
|
-
declare const createAccessToken: (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
token_type: string
|
|
28
|
-
expires_in?: number | undefined
|
|
29
|
-
refresh_token?: string | undefined
|
|
30
|
-
scope?: string | undefined
|
|
31
|
-
}>
|
|
19
|
+
declare const createAccessToken: (oauthConfig: OAuthProviderCredentials, redirectURI: string, code: string, codeVerifier: string) => Promise<{
|
|
20
|
+
access_token: string;
|
|
21
|
+
token_type: string;
|
|
22
|
+
expires_in?: number | undefined;
|
|
23
|
+
refresh_token?: string | undefined;
|
|
24
|
+
scope?: string | undefined;
|
|
25
|
+
}>;
|
|
32
26
|
|
|
33
|
-
export { createAccessToken }
|
|
27
|
+
export { createAccessToken };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
createAccessToken
|
|
3
|
+
} from "../../chunk-4V4JNXVF.js";
|
|
4
|
+
import "../../chunk-WD7AUHQ5.js";
|
|
5
|
+
import "../../chunk-CXLATHS5.js";
|
|
6
|
+
import "../../chunk-RRLIF4PQ.js";
|
|
7
|
+
export {
|
|
8
|
+
createAccessToken
|
|
9
|
+
};
|