@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.
@@ -5,7 +5,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
5
5
  entries: {
6
6
  [k: string]: {
7
7
  clientName: string | undefined;
8
- providerInstance: import("citra").BaseOAuth2Client<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
8
+ providerInstance: import("citra").BaseOAuth2Client<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
9
9
  scope: string[] | undefined;
10
10
  searchParams: [string, string][] | undefined;
11
11
  };
@@ -15,7 +15,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
15
15
  }>;
16
16
  export declare const normalizeProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => {
17
17
  [k: string]: {
18
- [k: string]: OAuth2ProviderClientConfiguration<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
18
+ [k: string]: OAuth2ProviderClientConfiguration<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
19
19
  };
20
20
  };
21
21
  export declare const resolveClientProviderEntry: ({ clientName, clientProviders, providerName }: {
@@ -46,7 +46,7 @@ export declare const resolveProviderClientConfiguration: ({ clientName, provider
46
46
  error: "Client provider not found";
47
47
  config?: undefined;
48
48
  } | {
49
- config: OAuth2ProviderClientConfiguration<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom"> | undefined;
49
+ config: OAuth2ProviderClientConfiguration<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom"> | undefined;
50
50
  readonly error?: undefined;
51
51
  } | {
52
52
  error: "Client variant is required";
@@ -427,6 +427,27 @@ var providers = defineProviders({
427
427
  url: "https://www.bungie.net/Platform/App/OAuth/token"
428
428
  }
429
429
  },
430
+ calendly: {
431
+ authorizationUrl: "https://auth.calendly.com/oauth/authorize",
432
+ email: ["resource", "email"],
433
+ fullName: ["resource", "name"],
434
+ isOIDC: false,
435
+ isRefreshable: true,
436
+ profileRequest: {
437
+ authIn: "header",
438
+ encoding: "application/json",
439
+ method: "GET",
440
+ url: "https://api.calendly.com/users/me"
441
+ },
442
+ scopeRequired: false,
443
+ subject: ["resource", "uri"],
444
+ subjectType: "string",
445
+ tokenRequest: {
446
+ authIn: "body",
447
+ encoding: "application/x-www-form-urlencoded",
448
+ url: "https://auth.calendly.com/oauth/token"
449
+ }
450
+ },
430
451
  close: {
431
452
  authorizationUrl: "https://app.close.com/oauth2/authorize/",
432
453
  isOIDC: false,
@@ -1426,6 +1447,33 @@ var providers = defineProviders({
1426
1447
  url: "https://slack.com/api/openid.connect.token"
1427
1448
  }
1428
1449
  },
1450
+ slackuser: {
1451
+ accessTokenPath: ["authed_user", "access_token"],
1452
+ authorizationUrl: "https://slack.com/oauth/v2/authorize",
1453
+ isOIDC: false,
1454
+ isRefreshable: false,
1455
+ profileRequest: {
1456
+ authIn: "header",
1457
+ encoding: "application/json",
1458
+ method: "POST",
1459
+ url: "https://slack.com/api/auth.test"
1460
+ },
1461
+ revocationRequest: {
1462
+ authIn: "body",
1463
+ encoding: "application/json",
1464
+ tokenParamName: "token",
1465
+ url: "https://slack.com/api/auth.revoke"
1466
+ },
1467
+ scopeParamName: "user_scope",
1468
+ scopeRequired: true,
1469
+ subject: ["user_id"],
1470
+ subjectType: "string",
1471
+ tokenRequest: {
1472
+ authIn: "body",
1473
+ encoding: "application/x-www-form-urlencoded",
1474
+ url: "https://slack.com/api/oauth.v2.access"
1475
+ }
1476
+ },
1429
1477
  spotify: {
1430
1478
  authorizationUrl: "https://accounts.spotify.com/authorize",
1431
1479
  isOIDC: false,
@@ -2339,6 +2387,7 @@ var providerOptions = Object.keys(providers).filter(isValidProviderOption);
2339
2387
  var refreshableProviderOptions = Object.keys(providers).filter(isRefreshableProviderOption);
2340
2388
  var revocableProviderOptions = Object.keys(providers).filter(isRevocableProviderOption);
2341
2389
  var scopeRequiredProviderOptions = Object.keys(providers).filter(isScopeRequiredProviderOption);
2390
+ var readPath = (value, path) => path.reduce((cursor, key) => cursor && typeof cursor === "object" ? Reflect.get(cursor, key) : undefined, value);
2342
2391
  var createOAuth2Client = async (providerName, config) => {
2343
2392
  const meta = providers[providerName];
2344
2393
  const isConfigPropertyFunction = (cfgProp) => typeof cfgProp === "function";
@@ -2360,7 +2409,7 @@ var createOAuth2Client = async (providerName, config) => {
2360
2409
  url.searchParams.set("state", state);
2361
2410
  if (scope.length !== 0) {
2362
2411
  const delimeter = providerName === "withings" ? "," : " ";
2363
- url.searchParams.set("scope", scope.join(delimeter));
2412
+ url.searchParams.set(meta.scopeParamName ?? "scope", scope.join(delimeter));
2364
2413
  }
2365
2414
  if (meta.PKCEMethod !== undefined) {
2366
2415
  if (!codeVerifier) {
@@ -2531,7 +2580,12 @@ var createOAuth2Client = async (providerName, config) => {
2531
2580
  });
2532
2581
  if (!response.ok)
2533
2582
  throw await createOAuth2FetchError(response);
2534
- return response.json();
2583
+ const tokenResponse = await response.json();
2584
+ const nestedToken = meta.accessTokenPath ? readPath(tokenResponse, meta.accessTokenPath) : undefined;
2585
+ if (typeof nestedToken === "string" && nestedToken.length > 0 && tokenResponse && typeof tokenResponse === "object") {
2586
+ tokenResponse.access_token = nestedToken;
2587
+ }
2588
+ return tokenResponse;
2535
2589
  }
2536
2590
  };
2537
2591
  };
@@ -2554,5 +2608,5 @@ export {
2554
2608
  decodeJWT
2555
2609
  };
2556
2610
 
2557
- //# debugId=2E1CE4D0162FAFF764756E2164756E21
2611
+ //# debugId=03B0ED8A60D9E20164756E2164756E21
2558
2612
  //# sourceMappingURL=index.js.map