@absolutejs/auth 0.53.2 → 0.53.4

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.
@@ -94,117 +94,117 @@
94
94
  },
95
95
  {
96
96
  "description": "Discord OAuth client id",
97
- "docsUrl": "https://github.com/absolutejs/auth#providers",
97
+ "docsUrl": "https://discord.com/developers/applications",
98
98
  "key": "DISCORD_CLIENT_ID",
99
99
  "when": "providersConfiguration.discord"
100
100
  },
101
101
  {
102
102
  "description": "Discord OAuth client secret",
103
- "docsUrl": "https://github.com/absolutejs/auth#providers",
103
+ "docsUrl": "https://discord.com/developers/applications",
104
104
  "key": "DISCORD_CLIENT_SECRET",
105
105
  "secret": true,
106
106
  "when": "providersConfiguration.discord"
107
107
  },
108
108
  {
109
109
  "description": "Facebook OAuth client id",
110
- "docsUrl": "https://github.com/absolutejs/auth#providers",
110
+ "docsUrl": "https://developers.facebook.com/apps",
111
111
  "key": "FACEBOOK_CLIENT_ID",
112
112
  "when": "providersConfiguration.facebook"
113
113
  },
114
114
  {
115
115
  "description": "Facebook OAuth client secret",
116
- "docsUrl": "https://github.com/absolutejs/auth#providers",
116
+ "docsUrl": "https://developers.facebook.com/apps",
117
117
  "key": "FACEBOOK_CLIENT_SECRET",
118
118
  "secret": true,
119
119
  "when": "providersConfiguration.facebook"
120
120
  },
121
121
  {
122
122
  "description": "Github OAuth client id",
123
- "docsUrl": "https://github.com/absolutejs/auth#providers",
123
+ "docsUrl": "https://github.com/settings/developers",
124
124
  "key": "GITHUB_CLIENT_ID",
125
125
  "when": "providersConfiguration.github"
126
126
  },
127
127
  {
128
128
  "description": "Github OAuth client secret",
129
- "docsUrl": "https://github.com/absolutejs/auth#providers",
129
+ "docsUrl": "https://github.com/settings/developers",
130
130
  "key": "GITHUB_CLIENT_SECRET",
131
131
  "secret": true,
132
132
  "when": "providersConfiguration.github"
133
133
  },
134
134
  {
135
135
  "description": "Google OAuth client id",
136
- "docsUrl": "https://github.com/absolutejs/auth#providers",
136
+ "docsUrl": "https://console.cloud.google.com/apis/credentials",
137
137
  "key": "GOOGLE_CLIENT_ID",
138
138
  "when": "providersConfiguration.google"
139
139
  },
140
140
  {
141
141
  "description": "Google OAuth client secret",
142
- "docsUrl": "https://github.com/absolutejs/auth#providers",
142
+ "docsUrl": "https://console.cloud.google.com/apis/credentials",
143
143
  "key": "GOOGLE_CLIENT_SECRET",
144
144
  "secret": true,
145
145
  "when": "providersConfiguration.google"
146
146
  },
147
147
  {
148
148
  "description": "Linkedin OAuth client id",
149
- "docsUrl": "https://github.com/absolutejs/auth#providers",
149
+ "docsUrl": "https://www.linkedin.com/developers/apps",
150
150
  "key": "LINKEDIN_CLIENT_ID",
151
151
  "when": "providersConfiguration.linkedin"
152
152
  },
153
153
  {
154
154
  "description": "Linkedin OAuth client secret",
155
- "docsUrl": "https://github.com/absolutejs/auth#providers",
155
+ "docsUrl": "https://www.linkedin.com/developers/apps",
156
156
  "key": "LINKEDIN_CLIENT_SECRET",
157
157
  "secret": true,
158
158
  "when": "providersConfiguration.linkedin"
159
159
  },
160
160
  {
161
161
  "description": "Microsoft OAuth client id",
162
- "docsUrl": "https://github.com/absolutejs/auth#providers",
162
+ "docsUrl": "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",
163
163
  "key": "MICROSOFT_CLIENT_ID",
164
164
  "when": "providersConfiguration.microsoft"
165
165
  },
166
166
  {
167
167
  "description": "Microsoft OAuth client secret",
168
- "docsUrl": "https://github.com/absolutejs/auth#providers",
168
+ "docsUrl": "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",
169
169
  "key": "MICROSOFT_CLIENT_SECRET",
170
170
  "secret": true,
171
171
  "when": "providersConfiguration.microsoft"
172
172
  },
173
173
  {
174
174
  "description": "Slack OAuth client id",
175
- "docsUrl": "https://github.com/absolutejs/auth#providers",
175
+ "docsUrl": "https://api.slack.com/apps",
176
176
  "key": "SLACK_CLIENT_ID",
177
177
  "when": "providersConfiguration.slack"
178
178
  },
179
179
  {
180
180
  "description": "Slack OAuth client secret",
181
- "docsUrl": "https://github.com/absolutejs/auth#providers",
181
+ "docsUrl": "https://api.slack.com/apps",
182
182
  "key": "SLACK_CLIENT_SECRET",
183
183
  "secret": true,
184
184
  "when": "providersConfiguration.slack"
185
185
  },
186
186
  {
187
187
  "description": "Spotify OAuth client id",
188
- "docsUrl": "https://github.com/absolutejs/auth#providers",
188
+ "docsUrl": "https://developer.spotify.com/dashboard",
189
189
  "key": "SPOTIFY_CLIENT_ID",
190
190
  "when": "providersConfiguration.spotify"
191
191
  },
192
192
  {
193
193
  "description": "Spotify OAuth client secret",
194
- "docsUrl": "https://github.com/absolutejs/auth#providers",
194
+ "docsUrl": "https://developer.spotify.com/dashboard",
195
195
  "key": "SPOTIFY_CLIENT_SECRET",
196
196
  "secret": true,
197
197
  "when": "providersConfiguration.spotify"
198
198
  },
199
199
  {
200
200
  "description": "Twitch OAuth client id",
201
- "docsUrl": "https://github.com/absolutejs/auth#providers",
201
+ "docsUrl": "https://dev.twitch.tv/console/apps",
202
202
  "key": "TWITCH_CLIENT_ID",
203
203
  "when": "providersConfiguration.twitch"
204
204
  },
205
205
  {
206
206
  "description": "Twitch OAuth client secret",
207
- "docsUrl": "https://github.com/absolutejs/auth#providers",
207
+ "docsUrl": "https://dev.twitch.tv/console/apps",
208
208
  "key": "TWITCH_CLIENT_SECRET",
209
209
  "secret": true,
210
210
  "when": "providersConfiguration.twitch"
@@ -215,6 +215,19 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
215
215
  encoding: "application/x-www-form-urlencoded";
216
216
  url: string;
217
217
  };
218
+ } & import("citra").ProviderConfig) | ({
219
+ authorizationUrl: (config: any) => string;
220
+ isOIDC: true;
221
+ isRefreshable: true;
222
+ PKCEMethod: "S256";
223
+ scopeRequired: false;
224
+ subject: string[];
225
+ subjectType: "string";
226
+ tokenRequest: {
227
+ authIn: "body";
228
+ encoding: "application/x-www-form-urlencoded";
229
+ url: (config: any) => string;
230
+ };
218
231
  } & import("citra").ProviderConfig) | ({
219
232
  authorizationUrl: string;
220
233
  isOIDC: true;
@@ -921,6 +934,19 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
921
934
  encoding: "application/x-www-form-urlencoded";
922
935
  url: string;
923
936
  };
937
+ } & import("citra").ProviderConfig) | ({
938
+ authorizationUrl: (config: any) => string;
939
+ isOIDC: true;
940
+ isRefreshable: true;
941
+ PKCEMethod: "S256";
942
+ scopeRequired: false;
943
+ subject: string[];
944
+ subjectType: "string";
945
+ tokenRequest: {
946
+ authIn: "body";
947
+ encoding: "application/x-www-form-urlencoded";
948
+ url: (config: any) => string;
949
+ };
924
950
  } & import("citra").ProviderConfig) | ({
925
951
  authorizationUrl: (config: any) => string;
926
952
  isOIDC: true;
@@ -1738,7 +1764,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
1738
1764
  url: string;
1739
1765
  };
1740
1766
  } & import("citra").ProviderConfig);
1741
- 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" | "onspark" | "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">;
1767
+ providerInstance: import("citra").BaseOAuth2Client<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "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" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "onspark" | "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">;
1742
1768
  requiresPKCE: boolean;
1743
1769
  scope: string[] | undefined;
1744
1770
  searchParams: [string, string][] | undefined;
@@ -1749,7 +1775,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
1749
1775
  }>;
1750
1776
  export declare const normalizeProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => {
1751
1777
  [k: string]: {
1752
- [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" | "onspark" | "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">;
1778
+ [k: string]: OAuth2ProviderClientConfiguration<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "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" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "onspark" | "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">;
1753
1779
  };
1754
1780
  };
1755
1781
  export declare const resolveClientProviderEntry: ({ clientName, clientProviders, providerName }: {
@@ -1780,7 +1806,7 @@ export declare const resolveProviderClientConfiguration: ({ clientName, provider
1780
1806
  error: "Client provider not found";
1781
1807
  config?: undefined;
1782
1808
  } | {
1783
- 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" | "onspark" | "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;
1809
+ config: OAuth2ProviderClientConfiguration<"42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "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" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "onspark" | "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;
1784
1810
  readonly error?: undefined;
1785
1811
  } | {
1786
1812
  error: "Client variant is required";
@@ -338,6 +338,20 @@ var providers = defineProviders({
338
338
  url: "https://developer.api.autodesk.com/authentication/v2/token"
339
339
  }
340
340
  },
341
+ azureadb2c: {
342
+ authorizationUrl: (config) => `https://${config.tenantSubdomain}.b2clogin.com/${config.tenantSubdomain}.onmicrosoft.com/${config.policy}/oauth2/v2.0/authorize`,
343
+ isOIDC: true,
344
+ isRefreshable: true,
345
+ PKCEMethod: "S256",
346
+ scopeRequired: false,
347
+ subject: ["sub"],
348
+ subjectType: "string",
349
+ tokenRequest: {
350
+ authIn: "body",
351
+ encoding: "application/x-www-form-urlencoded",
352
+ url: (config) => `https://${config.tenantSubdomain}.b2clogin.com/${config.tenantSubdomain}.onmicrosoft.com/${config.policy}/oauth2/v2.0/token`
353
+ }
354
+ },
341
355
  battlenet: {
342
356
  authorizationUrl: "https://oauth.battle.net/authorize",
343
357
  isOIDC: true,
@@ -1076,6 +1090,20 @@ var providers = defineProviders({
1076
1090
  url: "https://api.mercadopago.com/oauth/token"
1077
1091
  }
1078
1092
  },
1093
+ microsoftentraexternalid: {
1094
+ authorizationUrl: (config) => `https://${config.tenantSubdomain}.ciamlogin.com/${config.tenantId}/oauth2/v2.0/authorize`,
1095
+ isOIDC: true,
1096
+ isRefreshable: true,
1097
+ PKCEMethod: "S256",
1098
+ scopeRequired: false,
1099
+ subject: ["sub"],
1100
+ subjectType: "string",
1101
+ tokenRequest: {
1102
+ authIn: "body",
1103
+ encoding: "application/x-www-form-urlencoded",
1104
+ url: (config) => `https://${config.tenantSubdomain}.ciamlogin.com/${config.tenantId}/oauth2/v2.0/token`
1105
+ }
1106
+ },
1079
1107
  microsoftentraid: {
1080
1108
  authorizationUrl: (config) => `https://login.microsoftonline.com/${config.tenantId}/oauth2/v2.0/authorize`,
1081
1109
  isOIDC: true,
@@ -2109,10 +2137,7 @@ var getWithingsProps = async (config) => {
2109
2137
  nonceUrl.searchParams.set("timestamp", timestamp.toString());
2110
2138
  nonceUrl.searchParams.set("signature", hashedSignature);
2111
2139
  const nonceTarget = nonceUrl.toString();
2112
- const nonceResponse = await fetch(nonceTarget, {
2113
- ...h2IfHttps(nonceTarget),
2114
- method: "POST"
2115
- });
2140
+ const nonceResponse = await fetch(nonceTarget, { method: "POST" });
2116
2141
  const nonceData = await nonceResponse.json();
2117
2142
  if (nonceData.status === 0) {
2118
2143
  return {
@@ -2122,10 +2147,6 @@ var getWithingsProps = async (config) => {
2122
2147
  }
2123
2148
  return;
2124
2149
  };
2125
- var h2IfHttps = (url) => {
2126
- const init = url.startsWith("https://") ? { protocol: "http2" } : {};
2127
- return init;
2128
- };
2129
2150
  var hmacSha256 = async (message, secret) => {
2130
2151
  const encoder = new TextEncoder;
2131
2152
  const key = await crypto.subtle.importKey("raw", encoder.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
@@ -2462,6 +2483,9 @@ var buildOAuth2Client = async (meta, config) => {
2462
2483
  },
2463
2484
  async fetchUserProfile(accessToken) {
2464
2485
  const { profileRequest } = meta;
2486
+ if (!profileRequest) {
2487
+ throw new Error("OIDC provider exposes identity through the id_token and does not define a UserInfo endpoint");
2488
+ }
2465
2489
  const {
2466
2490
  url,
2467
2491
  method,
@@ -2496,10 +2520,7 @@ var buildOAuth2Client = async (meta, config) => {
2496
2520
  init.body = encoding === "application/json" ? JSON.stringify(resolvedBody) : new URLSearchParams(resolvedBody).toString();
2497
2521
  }
2498
2522
  const profileTarget = endpoint.toString();
2499
- const response = await fetch(profileTarget, {
2500
- ...h2IfHttps(profileTarget),
2501
- ...init
2502
- });
2523
+ const response = await fetch(profileTarget, init);
2503
2524
  if (!response.ok)
2504
2525
  throw await createOAuth2FetchError(response);
2505
2526
  return response.json();
@@ -2524,9 +2545,7 @@ var buildOAuth2Client = async (meta, config) => {
2524
2545
  encoding,
2525
2546
  url: tokenUrl
2526
2547
  });
2527
- const response = await fetch(request, {
2528
- ...h2IfHttps(request.url)
2529
- });
2548
+ const response = await fetch(request);
2530
2549
  if (!response.ok)
2531
2550
  throw await createOAuth2FetchError(response);
2532
2551
  return response.json();
@@ -2580,9 +2599,7 @@ var buildOAuth2Client = async (meta, config) => {
2580
2599
  url: `${endpoint.toString()}?${tokenParamName}=${token}`
2581
2600
  });
2582
2601
  }
2583
- const response = await fetch(request, {
2584
- ...h2IfHttps(request.url)
2585
- });
2602
+ const response = await fetch(request);
2586
2603
  if (!response.ok)
2587
2604
  throw await createOAuth2FetchError(response);
2588
2605
  },
@@ -2614,9 +2631,7 @@ var buildOAuth2Client = async (meta, config) => {
2614
2631
  encoding,
2615
2632
  url: tokenUrl
2616
2633
  });
2617
- const response = await fetch(request, {
2618
- ...h2IfHttps(request.url)
2619
- });
2634
+ const response = await fetch(request);
2620
2635
  if (!response.ok)
2621
2636
  throw await createOAuth2FetchError(response);
2622
2637
  const tokenResponse = await response.json();
@@ -2649,5 +2664,5 @@ export {
2649
2664
  decodeJWT
2650
2665
  };
2651
2666
 
2652
- //# debugId=0CC902D420872DEC64756E2164756E21
2667
+ //# debugId=92579E14784B330264756E2164756E21
2653
2668
  //# sourceMappingURL=index.js.map