@absolutejs/auth 0.48.0 → 0.48.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/cli/migrate.js +49 -1
- package/dist/cli/migrate.js.map +3 -3
- package/dist/htmx/index.js +57 -3
- package/dist/htmx/index.js.map +3 -3
- package/dist/index.js +57 -3
- package/dist/index.js.map +3 -3
- package/dist/providers/clients.d.ts +3 -3
- package/dist/providers/index.js +57 -3
- package/dist/providers/index.js.map +3 -3
- package/dist/routes/authorize.d.ts +2 -2
- package/dist/typebox.d.ts +1 -1
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -562,6 +562,27 @@ var providers = defineProviders({
|
|
|
562
562
|
url: "https://www.bungie.net/Platform/App/OAuth/token"
|
|
563
563
|
}
|
|
564
564
|
},
|
|
565
|
+
calendly: {
|
|
566
|
+
authorizationUrl: "https://auth.calendly.com/oauth/authorize",
|
|
567
|
+
email: ["resource", "email"],
|
|
568
|
+
fullName: ["resource", "name"],
|
|
569
|
+
isOIDC: false,
|
|
570
|
+
isRefreshable: true,
|
|
571
|
+
profileRequest: {
|
|
572
|
+
authIn: "header",
|
|
573
|
+
encoding: "application/json",
|
|
574
|
+
method: "GET",
|
|
575
|
+
url: "https://api.calendly.com/users/me"
|
|
576
|
+
},
|
|
577
|
+
scopeRequired: false,
|
|
578
|
+
subject: ["resource", "uri"],
|
|
579
|
+
subjectType: "string",
|
|
580
|
+
tokenRequest: {
|
|
581
|
+
authIn: "body",
|
|
582
|
+
encoding: "application/x-www-form-urlencoded",
|
|
583
|
+
url: "https://auth.calendly.com/oauth/token"
|
|
584
|
+
}
|
|
585
|
+
},
|
|
565
586
|
close: {
|
|
566
587
|
authorizationUrl: "https://app.close.com/oauth2/authorize/",
|
|
567
588
|
isOIDC: false,
|
|
@@ -1561,6 +1582,33 @@ var providers = defineProviders({
|
|
|
1561
1582
|
url: "https://slack.com/api/openid.connect.token"
|
|
1562
1583
|
}
|
|
1563
1584
|
},
|
|
1585
|
+
slackuser: {
|
|
1586
|
+
accessTokenPath: ["authed_user", "access_token"],
|
|
1587
|
+
authorizationUrl: "https://slack.com/oauth/v2/authorize",
|
|
1588
|
+
isOIDC: false,
|
|
1589
|
+
isRefreshable: false,
|
|
1590
|
+
profileRequest: {
|
|
1591
|
+
authIn: "header",
|
|
1592
|
+
encoding: "application/json",
|
|
1593
|
+
method: "POST",
|
|
1594
|
+
url: "https://slack.com/api/auth.test"
|
|
1595
|
+
},
|
|
1596
|
+
revocationRequest: {
|
|
1597
|
+
authIn: "body",
|
|
1598
|
+
encoding: "application/json",
|
|
1599
|
+
tokenParamName: "token",
|
|
1600
|
+
url: "https://slack.com/api/auth.revoke"
|
|
1601
|
+
},
|
|
1602
|
+
scopeParamName: "user_scope",
|
|
1603
|
+
scopeRequired: true,
|
|
1604
|
+
subject: ["user_id"],
|
|
1605
|
+
subjectType: "string",
|
|
1606
|
+
tokenRequest: {
|
|
1607
|
+
authIn: "body",
|
|
1608
|
+
encoding: "application/x-www-form-urlencoded",
|
|
1609
|
+
url: "https://slack.com/api/oauth.v2.access"
|
|
1610
|
+
}
|
|
1611
|
+
},
|
|
1564
1612
|
spotify: {
|
|
1565
1613
|
authorizationUrl: "https://accounts.spotify.com/authorize",
|
|
1566
1614
|
isOIDC: false,
|
|
@@ -2474,6 +2522,7 @@ var providerOptions = Object.keys(providers).filter(isValidProviderOption);
|
|
|
2474
2522
|
var refreshableProviderOptions = Object.keys(providers).filter(isRefreshableProviderOption);
|
|
2475
2523
|
var revocableProviderOptions = Object.keys(providers).filter(isRevocableProviderOption);
|
|
2476
2524
|
var scopeRequiredProviderOptions = Object.keys(providers).filter(isScopeRequiredProviderOption);
|
|
2525
|
+
var readPath = (value, path) => path.reduce((cursor, key) => cursor && typeof cursor === "object" ? Reflect.get(cursor, key) : undefined, value);
|
|
2477
2526
|
var createOAuth2Client = async (providerName, config) => {
|
|
2478
2527
|
const meta = providers[providerName];
|
|
2479
2528
|
const isConfigPropertyFunction = (cfgProp) => typeof cfgProp === "function";
|
|
@@ -2495,7 +2544,7 @@ var createOAuth2Client = async (providerName, config) => {
|
|
|
2495
2544
|
url.searchParams.set("state", state);
|
|
2496
2545
|
if (scope.length !== 0) {
|
|
2497
2546
|
const delimeter = providerName === "withings" ? "," : " ";
|
|
2498
|
-
url.searchParams.set("scope", scope.join(delimeter));
|
|
2547
|
+
url.searchParams.set(meta.scopeParamName ?? "scope", scope.join(delimeter));
|
|
2499
2548
|
}
|
|
2500
2549
|
if (meta.PKCEMethod !== undefined) {
|
|
2501
2550
|
if (!codeVerifier) {
|
|
@@ -2666,7 +2715,12 @@ var createOAuth2Client = async (providerName, config) => {
|
|
|
2666
2715
|
});
|
|
2667
2716
|
if (!response.ok)
|
|
2668
2717
|
throw await createOAuth2FetchError(response);
|
|
2669
|
-
|
|
2718
|
+
const tokenResponse = await response.json();
|
|
2719
|
+
const nestedToken = meta.accessTokenPath ? readPath(tokenResponse, meta.accessTokenPath) : undefined;
|
|
2720
|
+
if (typeof nestedToken === "string" && nestedToken.length > 0 && tokenResponse && typeof tokenResponse === "object") {
|
|
2721
|
+
tokenResponse.access_token = nestedToken;
|
|
2722
|
+
}
|
|
2723
|
+
return tokenResponse;
|
|
2670
2724
|
}
|
|
2671
2725
|
};
|
|
2672
2726
|
};
|
|
@@ -27532,5 +27586,5 @@ export {
|
|
|
27532
27586
|
AuthIdentityConflictError
|
|
27533
27587
|
};
|
|
27534
27588
|
|
|
27535
|
-
//# debugId=
|
|
27589
|
+
//# debugId=DCFE29575482C4FF64756E2164756E21
|
|
27536
27590
|
//# sourceMappingURL=index.js.map
|