@absolutejs/auth 0.48.1 → 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" | "calendly" | "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" | "calendly" | "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" | "calendly" | "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,44 +427,44 @@ var providers = defineProviders({
427
427
  url: "https://www.bungie.net/Platform/App/OAuth/token"
428
428
  }
429
429
  },
430
- close: {
431
- authorizationUrl: "https://app.close.com/oauth2/authorize/",
430
+ calendly: {
431
+ authorizationUrl: "https://auth.calendly.com/oauth/authorize",
432
+ email: ["resource", "email"],
433
+ fullName: ["resource", "name"],
432
434
  isOIDC: false,
433
435
  isRefreshable: true,
434
436
  profileRequest: {
435
437
  authIn: "header",
436
438
  encoding: "application/json",
437
439
  method: "GET",
438
- url: "https://api.close.com/api/v1/me/"
440
+ url: "https://api.calendly.com/users/me"
439
441
  },
440
- scopeRequired: true,
441
- subject: ["id"],
442
+ scopeRequired: false,
443
+ subject: ["resource", "uri"],
442
444
  subjectType: "string",
443
445
  tokenRequest: {
444
446
  authIn: "body",
445
447
  encoding: "application/x-www-form-urlencoded",
446
- url: "https://api.close.com/oauth2/token/"
448
+ url: "https://auth.calendly.com/oauth/token"
447
449
  }
448
450
  },
449
- calendly: {
450
- authorizationUrl: "https://auth.calendly.com/oauth/authorize",
451
- email: ["resource", "email"],
452
- fullName: ["resource", "name"],
451
+ close: {
452
+ authorizationUrl: "https://app.close.com/oauth2/authorize/",
453
453
  isOIDC: false,
454
454
  isRefreshable: true,
455
455
  profileRequest: {
456
456
  authIn: "header",
457
457
  encoding: "application/json",
458
458
  method: "GET",
459
- url: "https://api.calendly.com/users/me"
459
+ url: "https://api.close.com/api/v1/me/"
460
460
  },
461
- scopeRequired: false,
462
- subject: ["resource", "uri"],
461
+ scopeRequired: true,
462
+ subject: ["id"],
463
463
  subjectType: "string",
464
464
  tokenRequest: {
465
465
  authIn: "body",
466
466
  encoding: "application/x-www-form-urlencoded",
467
- url: "https://auth.calendly.com/oauth/token"
467
+ url: "https://api.close.com/oauth2/token/"
468
468
  }
469
469
  },
470
470
  coinbase: {
@@ -1447,6 +1447,33 @@ var providers = defineProviders({
1447
1447
  url: "https://slack.com/api/openid.connect.token"
1448
1448
  }
1449
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
+ },
1450
1477
  spotify: {
1451
1478
  authorizationUrl: "https://accounts.spotify.com/authorize",
1452
1479
  isOIDC: false,
@@ -2360,6 +2387,7 @@ var providerOptions = Object.keys(providers).filter(isValidProviderOption);
2360
2387
  var refreshableProviderOptions = Object.keys(providers).filter(isRefreshableProviderOption);
2361
2388
  var revocableProviderOptions = Object.keys(providers).filter(isRevocableProviderOption);
2362
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);
2363
2391
  var createOAuth2Client = async (providerName, config) => {
2364
2392
  const meta = providers[providerName];
2365
2393
  const isConfigPropertyFunction = (cfgProp) => typeof cfgProp === "function";
@@ -2381,7 +2409,7 @@ var createOAuth2Client = async (providerName, config) => {
2381
2409
  url.searchParams.set("state", state);
2382
2410
  if (scope.length !== 0) {
2383
2411
  const delimeter = providerName === "withings" ? "," : " ";
2384
- url.searchParams.set("scope", scope.join(delimeter));
2412
+ url.searchParams.set(meta.scopeParamName ?? "scope", scope.join(delimeter));
2385
2413
  }
2386
2414
  if (meta.PKCEMethod !== undefined) {
2387
2415
  if (!codeVerifier) {
@@ -2552,7 +2580,12 @@ var createOAuth2Client = async (providerName, config) => {
2552
2580
  });
2553
2581
  if (!response.ok)
2554
2582
  throw await createOAuth2FetchError(response);
2555
- 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;
2556
2589
  }
2557
2590
  };
2558
2591
  };
@@ -2575,5 +2608,5 @@ export {
2575
2608
  decodeJWT
2576
2609
  };
2577
2610
 
2578
- //# debugId=DCC64C2AFDC810AF64756E2164756E21
2611
+ //# debugId=03B0ED8A60D9E20164756E2164756E21
2579
2612
  //# sourceMappingURL=index.js.map