@absolutejs/auth 0.34.0 → 0.35.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.
@@ -0,0 +1,2719 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+
4
+ // src/adaptive/postgresStores.ts
5
+ import { and, desc, eq } from "drizzle-orm";
6
+ import {
7
+ bigint,
8
+ boolean,
9
+ doublePrecision,
10
+ pgTable,
11
+ primaryKey,
12
+ varchar
13
+ } from "drizzle-orm/pg-core";
14
+
15
+ // src/stores/postgres.ts
16
+ import { neon } from "@neondatabase/serverless";
17
+ import { drizzle } from "drizzle-orm/neon-http";
18
+
19
+ // src/adaptive/postgresStores.ts
20
+ var ID_LENGTH = 255;
21
+ var knownDevicesTable = pgTable("auth_known_devices", {
22
+ device_id: varchar("device_id", { length: ID_LENGTH }).notNull(),
23
+ first_seen_at_ms: bigint("first_seen_at_ms", {
24
+ mode: "number"
25
+ }).notNull(),
26
+ label: varchar("label", { length: ID_LENGTH }),
27
+ last_seen_at_ms: bigint("last_seen_at_ms", {
28
+ mode: "number"
29
+ }).notNull(),
30
+ trusted: boolean("trusted").notNull().default(false),
31
+ user_id: varchar("user_id", { length: ID_LENGTH }).notNull()
32
+ }, (table) => [primaryKey({ columns: [table.user_id, table.device_id] })]);
33
+ var loginHistoryTable = pgTable("auth_login_history", {
34
+ attempt_id: varchar("attempt_id", { length: ID_LENGTH }).primaryKey(),
35
+ country: varchar("country", { length: ID_LENGTH }),
36
+ device_id: varchar("device_id", { length: ID_LENGTH }).notNull(),
37
+ ip_address: varchar("ip_address", { length: ID_LENGTH }),
38
+ latitude: doublePrecision("latitude"),
39
+ longitude: doublePrecision("longitude"),
40
+ outcome: varchar("outcome", { length: ID_LENGTH }).notNull(),
41
+ timestamp_ms: bigint("timestamp_ms", { mode: "number" }).notNull(),
42
+ user_id: varchar("user_id", { length: ID_LENGTH }).notNull()
43
+ });
44
+
45
+ // src/apikeys/postgresStores.ts
46
+ import { desc as desc2, eq as eq2, lt } from "drizzle-orm";
47
+ import { bigint as bigint2, pgTable as pgTable2, text, varchar as varchar2 } from "drizzle-orm/pg-core";
48
+ var ID_LENGTH2 = 255;
49
+ var accessTokensTable = pgTable2("auth_access_tokens", {
50
+ client_id: varchar2("client_id", { length: ID_LENGTH2 }).notNull(),
51
+ created_at_ms: bigint2("created_at_ms", { mode: "number" }).notNull(),
52
+ expires_at_ms: bigint2("expires_at_ms", { mode: "number" }).notNull(),
53
+ hashed_token: varchar2("hashed_token", { length: ID_LENGTH2 }).notNull(),
54
+ owner_id: varchar2("owner_id", { length: ID_LENGTH2 }),
55
+ scopes: text("scopes").array().notNull(),
56
+ token_id: varchar2("token_id", { length: ID_LENGTH2 }).primaryKey()
57
+ });
58
+ var apiClientsTable = pgTable2("auth_api_clients", {
59
+ client_id: varchar2("client_id", { length: ID_LENGTH2 }).primaryKey(),
60
+ created_at_ms: bigint2("created_at_ms", { mode: "number" }).notNull(),
61
+ hashed_secret: varchar2("hashed_secret", { length: ID_LENGTH2 }).notNull(),
62
+ name: varchar2("name", { length: ID_LENGTH2 }).notNull(),
63
+ owner_id: varchar2("owner_id", { length: ID_LENGTH2 }),
64
+ scopes: text("scopes").array().notNull()
65
+ });
66
+ var apiKeysTable = pgTable2("auth_api_keys", {
67
+ created_at_ms: bigint2("created_at_ms", { mode: "number" }).notNull(),
68
+ expires_at_ms: bigint2("expires_at_ms", { mode: "number" }),
69
+ hashed_key: varchar2("hashed_key", { length: ID_LENGTH2 }).notNull(),
70
+ key_id: varchar2("key_id", { length: ID_LENGTH2 }).primaryKey(),
71
+ last_used_at_ms: bigint2("last_used_at_ms", { mode: "number" }),
72
+ name: varchar2("name", { length: ID_LENGTH2 }).notNull(),
73
+ owner_id: varchar2("owner_id", { length: ID_LENGTH2 }),
74
+ prefix: varchar2("prefix", { length: ID_LENGTH2 }).notNull(),
75
+ scopes: text("scopes").array().notNull()
76
+ });
77
+
78
+ // src/audit/postgresAuditStore.ts
79
+ import { desc as desc3, eq as eq3, lt as lt2 } from "drizzle-orm";
80
+ import { bigint as bigint3, jsonb, pgTable as pgTable3, varchar as varchar3 } from "drizzle-orm/pg-core";
81
+ var ID_LENGTH3 = 255;
82
+ var IP_LENGTH = 64;
83
+ var TYPE_LENGTH = 64;
84
+ var auditEventsTable = pgTable3("auth_audit_events", {
85
+ at_ms: bigint3("at_ms", { mode: "number" }).notNull(),
86
+ id: varchar3("id", { length: ID_LENGTH3 }).primaryKey(),
87
+ ip: varchar3("ip", { length: IP_LENGTH }),
88
+ metadata_json: jsonb("metadata_json").$type(),
89
+ organization_id: varchar3("organization_id", { length: ID_LENGTH3 }),
90
+ type: varchar3("type", { length: TYPE_LENGTH }).notNull(),
91
+ user_id: varchar3("user_id", { length: ID_LENGTH3 })
92
+ });
93
+
94
+ // src/credentials/postgresCredentialStore.ts
95
+ import { eq as eq4 } from "drizzle-orm";
96
+ import { bigint as bigint4, boolean as boolean2, pgTable as pgTable4, text as text2, varchar as varchar4 } from "drizzle-orm/pg-core";
97
+ var EMAIL_LENGTH = 320;
98
+ var ID_LENGTH4 = 255;
99
+ var STATUS_LENGTH = 32;
100
+ var TOKEN_HASH_LENGTH = 255;
101
+ var credentialsTable = pgTable4("auth_credentials", {
102
+ created_at_ms: bigint4("created_at_ms", { mode: "number" }).notNull(),
103
+ email: varchar4("email", { length: EMAIL_LENGTH }).primaryKey(),
104
+ email_verified: boolean2("email_verified").notNull().default(false),
105
+ organization_id: varchar4("organization_id", { length: ID_LENGTH4 }),
106
+ password_hash: text2("password_hash").notNull(),
107
+ status: varchar4("status", { length: STATUS_LENGTH }).notNull().default("active"),
108
+ updated_at_ms: bigint4("updated_at_ms", { mode: "number" }).notNull(),
109
+ user_id: varchar4("user_id", { length: ID_LENGTH4 })
110
+ });
111
+ var createTokenTable = (name) => pgTable4(name, {
112
+ email: varchar4("email", { length: EMAIL_LENGTH }).notNull(),
113
+ expires_at_ms: bigint4("expires_at_ms", { mode: "number" }).notNull(),
114
+ token_hash: varchar4("token_hash", {
115
+ length: TOKEN_HASH_LENGTH
116
+ }).primaryKey()
117
+ });
118
+ var credentialResetTokensTable = createTokenTable("auth_credential_reset_tokens");
119
+ var credentialVerificationTokensTable = createTokenTable("auth_credential_verification_tokens");
120
+
121
+ // src/fga/postgresStores.ts
122
+ import { and as and2, eq as eq5 } from "drizzle-orm";
123
+ import { pgTable as pgTable5, varchar as varchar5 } from "drizzle-orm/pg-core";
124
+ var ID_LENGTH5 = 255;
125
+ var warrantsTable = pgTable5("auth_fga_warrants", {
126
+ id: varchar5("id", { length: ID_LENGTH5 }).primaryKey(),
127
+ relation: varchar5("relation", { length: ID_LENGTH5 }).notNull(),
128
+ resource_id: varchar5("resource_id", { length: ID_LENGTH5 }).notNull(),
129
+ resource_type: varchar5("resource_type", { length: ID_LENGTH5 }).notNull(),
130
+ subject_id: varchar5("subject_id", { length: ID_LENGTH5 }).notNull(),
131
+ subject_relation: varchar5("subject_relation", { length: ID_LENGTH5 }),
132
+ subject_type: varchar5("subject_type", { length: ID_LENGTH5 }).notNull()
133
+ });
134
+
135
+ // src/linkedProviders/neonStores.ts
136
+ import { neon as neon2 } from "@neondatabase/serverless";
137
+ import { desc as desc4, eq as eq6 } from "drizzle-orm";
138
+ import { drizzle as drizzle2 } from "drizzle-orm/neon-http";
139
+ import {
140
+ jsonb as jsonb2,
141
+ pgTable as pgTable6,
142
+ text as text3,
143
+ timestamp,
144
+ varchar as varchar6
145
+ } from "drizzle-orm/pg-core";
146
+
147
+ // node_modules/citra/dist/index.js
148
+ var NUM_GENERATOR_BYTES = 32;
149
+ var anilistProfileQuery = `query {
150
+ Viewer {
151
+ id
152
+ name
153
+ about
154
+ avatar {
155
+ large
156
+ medium
157
+ }
158
+ bannerImage
159
+ siteUrl
160
+ createdAt
161
+ updatedAt
162
+ donatorTier
163
+ donatorBadge
164
+ unreadNotificationCount
165
+ options {
166
+ titleLanguage
167
+ displayAdultContent
168
+ airingNotifications
169
+ profileColor
170
+ activityMergeTime
171
+ staffNameLanguage
172
+ }
173
+ mediaListOptions {
174
+ scoreFormat
175
+ rowOrder
176
+ animeList {
177
+ sectionOrder
178
+ customLists
179
+ advancedScoringEnabled
180
+ }
181
+ mangaList {
182
+ sectionOrder
183
+ customLists
184
+ advancedScoringEnabled
185
+ }
186
+ }
187
+ statistics {
188
+ anime {
189
+ count
190
+ meanScore
191
+ minutesWatched
192
+ episodesWatched
193
+ }
194
+ manga {
195
+ count
196
+ meanScore
197
+ chaptersRead
198
+ volumesRead
199
+ }
200
+ }
201
+ favourites {
202
+ anime {
203
+ nodes {
204
+ id
205
+ title {
206
+ romaji
207
+ english
208
+ }
209
+ siteUrl
210
+ }
211
+ }
212
+ manga {
213
+ nodes {
214
+ id
215
+ title {
216
+ romaji
217
+ english
218
+ }
219
+ siteUrl
220
+ }
221
+ }
222
+ characters {
223
+ nodes {
224
+ id
225
+ name {
226
+ full
227
+ }
228
+ image {
229
+ large
230
+ }
231
+ }
232
+ }
233
+ staff {
234
+ nodes {
235
+ id
236
+ name {
237
+ full
238
+ }
239
+ image {
240
+ large
241
+ }
242
+ }
243
+ }
244
+ studios {
245
+ nodes {
246
+ id
247
+ name
248
+ siteUrl
249
+ }
250
+ }
251
+ }
252
+ isFollower
253
+ isFollowing
254
+ }
255
+ }`;
256
+ var defineProviders = (providers) => providers;
257
+ var providers = defineProviders({
258
+ "42": {
259
+ authorizationUrl: "https://api.intra.42.fr/oauth/authorize",
260
+ isOIDC: false,
261
+ isRefreshable: true,
262
+ profileRequest: {
263
+ authIn: "header",
264
+ encoding: "application/json",
265
+ method: "GET",
266
+ url: "https://api.intra.42.fr/v2/me"
267
+ },
268
+ scopeRequired: false,
269
+ subject: ["id"],
270
+ subjectType: "string",
271
+ tokenRequest: {
272
+ authIn: "body",
273
+ encoding: "application/x-www-form-urlencoded",
274
+ url: "https://api.intra.42.fr/oauth/token"
275
+ }
276
+ },
277
+ amazoncognito: {
278
+ authorizationUrl: "https://${domain}/oauth2/authorize",
279
+ isOIDC: true,
280
+ isRefreshable: true,
281
+ PKCEMethod: "S256",
282
+ profileRequest: {
283
+ authIn: "header",
284
+ encoding: "application/json",
285
+ method: "GET",
286
+ url: (config) => `https://${config.domain}/oauth2/userInfo`
287
+ },
288
+ revocationRequest: {
289
+ authIn: "body",
290
+ encoding: "application/json",
291
+ tokenParamName: "token",
292
+ url: (config) => `https://${config.domain}/oauth2/revoke`
293
+ },
294
+ scopeRequired: false,
295
+ subject: ["id"],
296
+ subjectType: "string",
297
+ tokenRequest: {
298
+ authIn: "body",
299
+ encoding: "application/x-www-form-urlencoded",
300
+ url: (config) => `https://${config.domain}/oauth2/token`
301
+ }
302
+ },
303
+ anilist: {
304
+ authorizationUrl: "https://anilist.co/api/v2/oauth/authorize",
305
+ isOIDC: false,
306
+ isRefreshable: true,
307
+ profileRequest: {
308
+ authIn: "header",
309
+ body: {
310
+ query: anilistProfileQuery
311
+ },
312
+ encoding: "application/json",
313
+ headers: {
314
+ Accept: "application/json",
315
+ "Content-Type": "application/json"
316
+ },
317
+ method: "POST",
318
+ url: "https://graphql.anilist.co"
319
+ },
320
+ scopeRequired: false,
321
+ subject: ["data", "Viewer", "id"],
322
+ subjectType: "number",
323
+ tokenRequest: {
324
+ authIn: "body",
325
+ encoding: "application/x-www-form-urlencoded",
326
+ url: "https://anilist.co/api/v2/oauth/token"
327
+ }
328
+ },
329
+ apple: {
330
+ authorizationUrl: "https://appleid.apple.com/auth/authorize",
331
+ isOIDC: true,
332
+ isRefreshable: true,
333
+ PKCEMethod: "S256",
334
+ profileRequest: {
335
+ authIn: "header",
336
+ encoding: "application/json",
337
+ method: "GET",
338
+ url: "https://appleid.apple.com/auth/userinfo"
339
+ },
340
+ scopeRequired: false,
341
+ subject: ["id"],
342
+ subjectType: "string",
343
+ tokenRequest: {
344
+ authIn: "body",
345
+ encoding: "application/x-www-form-urlencoded",
346
+ url: "https://appleid.apple.com/auth/token"
347
+ }
348
+ },
349
+ atlassian: {
350
+ authorizationUrl: "https://auth.atlassian.com/authorize",
351
+ createAuthorizationURLSearchParams: {
352
+ audience: "api.atlassian.com"
353
+ },
354
+ email: ["email"],
355
+ fullName: ["name"],
356
+ isOIDC: false,
357
+ isRefreshable: true,
358
+ picture: ["picture"],
359
+ profileRequest: {
360
+ authIn: "header",
361
+ encoding: "application/json",
362
+ method: "GET",
363
+ url: "https://api.atlassian.com/me"
364
+ },
365
+ scopeRequired: true,
366
+ subject: ["account_id"],
367
+ subjectType: "string",
368
+ tokenRequest: {
369
+ authIn: "body",
370
+ encoding: "application/x-www-form-urlencoded",
371
+ url: "https://auth.atlassian.com/oauth/token"
372
+ }
373
+ },
374
+ attio: {
375
+ authorizationUrl: "https://app.attio.com/authorize",
376
+ isOIDC: false,
377
+ isRefreshable: true,
378
+ profileRequest: {
379
+ authIn: "header",
380
+ encoding: "application/json",
381
+ method: "GET",
382
+ url: "https://api.attio.com/v2/self"
383
+ },
384
+ scopeRequired: true,
385
+ subject: ["workspace_id"],
386
+ subjectType: "string",
387
+ tokenRequest: {
388
+ authIn: "body",
389
+ encoding: "application/x-www-form-urlencoded",
390
+ url: "https://app.attio.com/oauth/token"
391
+ }
392
+ },
393
+ auth0: {
394
+ authorizationUrl: (config) => `https://${config.domain}/authorize`,
395
+ isOIDC: true,
396
+ isRefreshable: true,
397
+ PKCEMethod: "S256",
398
+ profileRequest: {
399
+ authIn: "header",
400
+ encoding: "application/json",
401
+ method: "GET",
402
+ url: (config) => `https://${config.domain}/userinfo`
403
+ },
404
+ revocationRequest: {
405
+ authIn: "body",
406
+ body: new URLSearchParams({
407
+ token_type_hint: "refresh_token"
408
+ }),
409
+ encoding: "application/json",
410
+ tokenParamName: "token",
411
+ url: (config) => `https://${config.domain}/oauth/revoke`
412
+ },
413
+ scopeRequired: false,
414
+ subject: ["id"],
415
+ subjectType: "string",
416
+ tokenRequest: {
417
+ authIn: "body",
418
+ encoding: "application/x-www-form-urlencoded",
419
+ url: (config) => `https://${config.domain}/oauth/token`
420
+ }
421
+ },
422
+ authentik: {
423
+ authorizationUrl: (config) => `https://${config.baseURL}/oauth/authorize`,
424
+ isOIDC: true,
425
+ isRefreshable: true,
426
+ PKCEMethod: "S256",
427
+ profileRequest: {
428
+ authIn: "header",
429
+ encoding: "application/json",
430
+ method: "GET",
431
+ url: (config) => `https://${config.baseURL}/api/v3/user/`
432
+ },
433
+ scopeRequired: false,
434
+ subject: ["id"],
435
+ subjectType: "string",
436
+ tokenRequest: {
437
+ authIn: "body",
438
+ encoding: "application/x-www-form-urlencoded",
439
+ url: (config) => `https://${config.baseURL}/oauth/token`
440
+ }
441
+ },
442
+ autodesk: {
443
+ authorizationUrl: "https://developer.api.autodesk.com/authentication/v2/authorize",
444
+ email: ["email"],
445
+ familyName: ["family_name"],
446
+ fullName: ["name"],
447
+ givenName: ["given_name"],
448
+ isOIDC: true,
449
+ isRefreshable: true,
450
+ picture: ["picture"],
451
+ PKCEMethod: "S256",
452
+ profileRequest: {
453
+ authIn: "header",
454
+ encoding: "application/json",
455
+ method: "GET",
456
+ url: "https://api.userprofile.autodesk.com/userinfo"
457
+ },
458
+ scopeRequired: false,
459
+ subject: ["id"],
460
+ subjectType: "string",
461
+ tokenRequest: {
462
+ authIn: "body",
463
+ encoding: "application/x-www-form-urlencoded",
464
+ url: "https://developer.api.autodesk.com/authentication/v2/token"
465
+ }
466
+ },
467
+ battlenet: {
468
+ authorizationUrl: "https://oauth.battle.net/authorize",
469
+ isOIDC: true,
470
+ isRefreshable: false,
471
+ profileRequest: {
472
+ authIn: "header",
473
+ encoding: "application/json",
474
+ method: "GET",
475
+ url: "https://oauth.battle.net/userinfo"
476
+ },
477
+ scopeRequired: false,
478
+ subject: ["id"],
479
+ subjectType: "string",
480
+ tokenRequest: {
481
+ authIn: "body",
482
+ encoding: "application/x-www-form-urlencoded",
483
+ url: "https://oauth.battle.net/token"
484
+ }
485
+ },
486
+ bitbucket: {
487
+ authorizationUrl: "https://bitbucket.org/site/oauth2/authorize",
488
+ fullName: ["display_name"],
489
+ isOIDC: false,
490
+ isRefreshable: true,
491
+ picture: ["links", "avatar", "href"],
492
+ profileRequest: {
493
+ authIn: "header",
494
+ encoding: "application/json",
495
+ method: "GET",
496
+ url: "https://api.bitbucket.org/2.0/user"
497
+ },
498
+ scopeRequired: false,
499
+ subject: ["uuid"],
500
+ subjectType: "string",
501
+ tokenRequest: {
502
+ authIn: "body",
503
+ encoding: "application/x-www-form-urlencoded",
504
+ url: "https://bitbucket.org/site/oauth2/access_token"
505
+ }
506
+ },
507
+ box: {
508
+ authorizationUrl: "https://account.box.com/api/oauth2/authorize",
509
+ email: ["login"],
510
+ fullName: ["name"],
511
+ isOIDC: false,
512
+ isRefreshable: true,
513
+ picture: ["avatar_url"],
514
+ profileRequest: {
515
+ authIn: "header",
516
+ encoding: "application/json",
517
+ method: "GET",
518
+ url: "https://api.box.com/2.0/users/me"
519
+ },
520
+ revocationRequest: {
521
+ authIn: "body",
522
+ encoding: "application/json",
523
+ tokenParamName: "token",
524
+ url: "https://api.box.com/oauth2/revoke"
525
+ },
526
+ scopeRequired: false,
527
+ subject: ["id"],
528
+ subjectType: "string",
529
+ tokenRequest: {
530
+ authIn: "body",
531
+ encoding: "application/x-www-form-urlencoded",
532
+ url: "https://api.box.com/oauth2/token"
533
+ }
534
+ },
535
+ bungie: {
536
+ authorizationUrl: "https://www.bungie.net/en/OAuth/Authorize",
537
+ isOIDC: false,
538
+ isRefreshable: true,
539
+ profileRequest: {
540
+ authIn: "header",
541
+ encoding: "application/json",
542
+ headers: {
543
+ "X-API-Key": "<YOUR_API_KEY>"
544
+ },
545
+ method: "GET",
546
+ url: "https://www.bungie.net/Platform/User/GetCurrentBungieNetUser"
547
+ },
548
+ scopeRequired: false,
549
+ subject: ["Response", "membershipId"],
550
+ subjectType: "number",
551
+ tokenRequest: {
552
+ authIn: "body",
553
+ encoding: "application/x-www-form-urlencoded",
554
+ url: "https://www.bungie.net/Platform/App/OAuth/token"
555
+ }
556
+ },
557
+ close: {
558
+ authorizationUrl: "https://app.close.com/oauth2/authorize/",
559
+ isOIDC: false,
560
+ isRefreshable: true,
561
+ profileRequest: {
562
+ authIn: "header",
563
+ encoding: "application/json",
564
+ method: "GET",
565
+ url: "https://api.close.com/api/v1/me/"
566
+ },
567
+ scopeRequired: true,
568
+ subject: ["id"],
569
+ subjectType: "string",
570
+ tokenRequest: {
571
+ authIn: "body",
572
+ encoding: "application/x-www-form-urlencoded",
573
+ url: "https://api.close.com/oauth2/token/"
574
+ }
575
+ },
576
+ coinbase: {
577
+ authorizationUrl: "https://www.coinbase.com/oauth/authorize",
578
+ isOIDC: false,
579
+ isRefreshable: true,
580
+ profileRequest: {
581
+ authIn: "header",
582
+ encoding: "application/json",
583
+ method: "GET",
584
+ url: "https://api.coinbase.com/v2/user"
585
+ },
586
+ scopeRequired: false,
587
+ subject: ["data", "id"],
588
+ subjectType: "number",
589
+ tokenRequest: {
590
+ authIn: "body",
591
+ encoding: "application/x-www-form-urlencoded",
592
+ url: "https://api.coinbase.com/oauth/token"
593
+ }
594
+ },
595
+ discord: {
596
+ authorizationUrl: "https://discord.com/api/oauth2/authorize",
597
+ email: ["email"],
598
+ isOIDC: true,
599
+ isRefreshable: true,
600
+ picture: ["avatar"],
601
+ PKCEMethod: "S256",
602
+ profileRequest: {
603
+ authIn: "header",
604
+ encoding: "application/json",
605
+ method: "GET",
606
+ url: "https://discord.com/api/users/@me"
607
+ },
608
+ scopeRequired: true,
609
+ subject: ["id"],
610
+ subjectType: "string",
611
+ tokenRequest: {
612
+ authIn: "body",
613
+ encoding: "application/x-www-form-urlencoded",
614
+ url: "https://discord.com/api/oauth2/token"
615
+ }
616
+ },
617
+ donationalerts: {
618
+ authorizationUrl: "https://www.donationalerts.com/oauth/authorize",
619
+ email: ["data", "email"],
620
+ isOIDC: false,
621
+ isRefreshable: true,
622
+ picture: ["data", "avatar"],
623
+ profileRequest: {
624
+ authIn: "header",
625
+ encoding: "application/json",
626
+ method: "GET",
627
+ url: "https://www.donationalerts.com/api/v1/user/oauth"
628
+ },
629
+ scopeRequired: false,
630
+ subject: ["data", "id"],
631
+ subjectType: "number",
632
+ tokenRequest: {
633
+ authIn: "body",
634
+ encoding: "application/x-www-form-urlencoded",
635
+ url: "https://www.donationalerts.com/oauth/token"
636
+ }
637
+ },
638
+ dribbble: {
639
+ authorizationUrl: "https://dribbble.com/oauth/authorize",
640
+ isOIDC: false,
641
+ isRefreshable: false,
642
+ profileRequest: {
643
+ authIn: "header",
644
+ encoding: "application/json",
645
+ method: "GET",
646
+ url: "https://api.dribbble.com/v2/user"
647
+ },
648
+ scopeRequired: false,
649
+ subject: ["id"],
650
+ subjectType: "number",
651
+ tokenRequest: {
652
+ authIn: "body",
653
+ encoding: "application/x-www-form-urlencoded",
654
+ url: "https://dribbble.com/oauth/token"
655
+ }
656
+ },
657
+ dropbox: {
658
+ authorizationUrl: "https://www.dropbox.com/oauth2/authorize",
659
+ email: ["email"],
660
+ familyName: ["name", "surname"],
661
+ fullName: ["name", "display_name"],
662
+ givenName: ["name", "given_name"],
663
+ isOIDC: false,
664
+ isRefreshable: true,
665
+ profileRequest: {
666
+ authIn: "header",
667
+ encoding: "application/json",
668
+ method: "POST",
669
+ url: "https://api.dropboxapi.com/2/users/get_current_account"
670
+ },
671
+ revocationRequest: {
672
+ authIn: "header",
673
+ encoding: "application/json",
674
+ url: "https://api.dropboxapi.com/2/auth/token/revoke"
675
+ },
676
+ scopeRequired: false,
677
+ subject: ["account_id"],
678
+ subjectType: "string",
679
+ tokenRequest: {
680
+ authIn: "body",
681
+ encoding: "application/x-www-form-urlencoded",
682
+ url: "https://api.dropboxapi.com/oauth2/token"
683
+ }
684
+ },
685
+ epicgames: {
686
+ authorizationUrl: "https://www.epicgames.com/id/authorize",
687
+ isOIDC: false,
688
+ isRefreshable: true,
689
+ profileRequest: {
690
+ authIn: "header",
691
+ encoding: "application/json",
692
+ method: "GET",
693
+ url: "https://api.epicgames.dev/epic/oauth/v2/userInfo"
694
+ },
695
+ scopeRequired: false,
696
+ subject: ["account_id"],
697
+ subjectType: "number",
698
+ tokenRequest: {
699
+ authIn: "body",
700
+ encoding: "application/x-www-form-urlencoded",
701
+ url: "https://api.epicgames.dev/epic/oauth/v1/token"
702
+ }
703
+ },
704
+ etsy: {
705
+ authorizationUrl: "https://www.etsy.com/oauth/connect",
706
+ isOIDC: false,
707
+ isRefreshable: true,
708
+ profileRequest: {
709
+ authIn: "header",
710
+ encoding: "application/json",
711
+ method: "GET",
712
+ url: "https://openapi.etsy.com/v3/application/users/me"
713
+ },
714
+ scopeRequired: false,
715
+ subject: ["results", "0", "user_id"],
716
+ subjectType: "number",
717
+ tokenRequest: {
718
+ authIn: "body",
719
+ encoding: "application/x-www-form-urlencoded",
720
+ url: "https://api.etsy.com/v3/public/oauth/token"
721
+ }
722
+ },
723
+ facebook: {
724
+ authorizationUrl: "https://www.facebook.com/v16.0/dialog/oauth",
725
+ email: ["email"],
726
+ familyName: ["family_name"],
727
+ fullName: ["name"],
728
+ givenName: ["given_name"],
729
+ isOIDC: true,
730
+ isRefreshable: false,
731
+ picture: ["picture"],
732
+ PKCEMethod: "S256",
733
+ profileRequest: {
734
+ authIn: "query",
735
+ encoding: "application/json",
736
+ method: "GET",
737
+ searchParams: [["fields", "id,name,email,picture"]],
738
+ url: "https://graph.facebook.com/me"
739
+ },
740
+ scopeRequired: false,
741
+ subject: ["sub"],
742
+ subjectBySource: {
743
+ idToken: ["sub"],
744
+ profile: ["id"]
745
+ },
746
+ subjectType: "string",
747
+ tokenRequest: {
748
+ authIn: "body",
749
+ encoding: "application/x-www-form-urlencoded",
750
+ url: "https://graph.facebook.com/v16.0/oauth/access_token"
751
+ }
752
+ },
753
+ figma: {
754
+ authorizationUrl: "https://www.figma.com/oauth",
755
+ email: ["email"],
756
+ isOIDC: false,
757
+ isRefreshable: true,
758
+ picture: ["img_url"],
759
+ PKCEMethod: "S256",
760
+ profileRequest: {
761
+ authIn: "header",
762
+ encoding: "application/json",
763
+ method: "GET",
764
+ url: "https://api.figma.com/v1/me"
765
+ },
766
+ scopeRequired: true,
767
+ subject: ["id"],
768
+ subjectType: "string",
769
+ tokenRequest: {
770
+ authIn: "body",
771
+ encoding: "application/x-www-form-urlencoded",
772
+ url: "https://api.figma.com/v1/oauth/token"
773
+ }
774
+ },
775
+ gitea: {
776
+ authorizationUrl: (config) => `${config.baseURL}/login/oauth/authorize`,
777
+ isOIDC: true,
778
+ isRefreshable: true,
779
+ PKCEMethod: "S256",
780
+ profileRequest: {
781
+ authIn: "header",
782
+ encoding: "application/json",
783
+ method: "GET",
784
+ url: (config) => `${config.baseURL}/api/v1/user`
785
+ },
786
+ scopeRequired: false,
787
+ subject: ["id"],
788
+ subjectType: "string",
789
+ tokenRequest: {
790
+ authIn: "body",
791
+ encoding: "application/x-www-form-urlencoded",
792
+ url: (config) => `${config.baseURL}/login/oauth/access_token`
793
+ }
794
+ },
795
+ github: {
796
+ authorizationUrl: "https://github.com/login/oauth/authorize",
797
+ email: ["email"],
798
+ isOIDC: false,
799
+ isRefreshable: false,
800
+ picture: ["avatar_url"],
801
+ profileRequest: {
802
+ authIn: "header",
803
+ encoding: "application/json",
804
+ method: "GET",
805
+ url: "https://api.github.com/user"
806
+ },
807
+ scopeRequired: false,
808
+ subject: ["id"],
809
+ subjectType: "number",
810
+ tokenRequest: {
811
+ authIn: "body",
812
+ encoding: "application/x-www-form-urlencoded",
813
+ url: "https://github.com/login/oauth/access_token"
814
+ }
815
+ },
816
+ gitlab: {
817
+ authorizationUrl: (config) => `${config.baseURL}/oauth/authorize`,
818
+ email: ["email"],
819
+ fullName: ["name"],
820
+ isOIDC: true,
821
+ isRefreshable: true,
822
+ picture: ["picture"],
823
+ PKCEMethod: "S256",
824
+ profileRequest: {
825
+ authIn: "header",
826
+ encoding: "application/json",
827
+ method: "GET",
828
+ url: "https://gitlab.com/api/v4/user"
829
+ },
830
+ revocationRequest: {
831
+ authIn: "body",
832
+ encoding: "application/json",
833
+ tokenParamName: "token",
834
+ url: (config) => `${config.baseURL}/oauth/revoke`
835
+ },
836
+ scopeRequired: false,
837
+ subject: ["id"],
838
+ subjectType: "string",
839
+ tokenRequest: {
840
+ authIn: "body",
841
+ encoding: "application/x-www-form-urlencoded",
842
+ url: (config) => `${config.baseURL}/oauth/token`
843
+ }
844
+ },
845
+ gohighlevel: {
846
+ authorizationUrl: "https://marketplace.gohighlevel.com/oauth/chooselocation",
847
+ isOIDC: false,
848
+ isRefreshable: true,
849
+ profileRequest: {
850
+ authIn: "header",
851
+ encoding: "application/json",
852
+ method: "GET",
853
+ url: "https://services.leadconnectorhq.com/users/me"
854
+ },
855
+ scopeRequired: true,
856
+ subject: ["id"],
857
+ subjectType: "string",
858
+ tokenRequest: {
859
+ authIn: "body",
860
+ encoding: "application/x-www-form-urlencoded",
861
+ url: "https://services.leadconnectorhq.com/oauth/token"
862
+ }
863
+ },
864
+ google: {
865
+ authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth",
866
+ email: ["email"],
867
+ familyName: ["family_name"],
868
+ fullName: ["name"],
869
+ givenName: ["given_name"],
870
+ isOIDC: true,
871
+ isRefreshable: true,
872
+ picture: ["picture"],
873
+ PKCEMethod: "S256",
874
+ profileRequest: {
875
+ authIn: "header",
876
+ encoding: "application/json",
877
+ method: "GET",
878
+ url: "https://openidconnect.googleapis.com/v1/userinfo"
879
+ },
880
+ revocationRequest: {
881
+ authIn: "body",
882
+ encoding: "application/json",
883
+ tokenParamName: "token",
884
+ url: "https://oauth2.googleapis.com/revoke"
885
+ },
886
+ scopeRequired: true,
887
+ subject: ["sub"],
888
+ subjectBySource: {
889
+ idToken: ["sub"],
890
+ profile: ["sub"]
891
+ },
892
+ subjectType: "string",
893
+ tokenRequest: {
894
+ authIn: "body",
895
+ encoding: "application/x-www-form-urlencoded",
896
+ url: "https://oauth2.googleapis.com/token"
897
+ }
898
+ },
899
+ hubspot: {
900
+ authorizationUrl: "https://app.hubspot.com/oauth/authorize",
901
+ isOIDC: false,
902
+ isRefreshable: true,
903
+ profileRequest: {
904
+ authIn: "header",
905
+ encoding: "application/json",
906
+ method: "GET",
907
+ url: "https://api.hubapi.com/oauth/v1/access-tokens/me"
908
+ },
909
+ scopeRequired: true,
910
+ subject: ["hub_id"],
911
+ subjectType: "number",
912
+ tokenRequest: {
913
+ authIn: "body",
914
+ encoding: "application/x-www-form-urlencoded",
915
+ url: "https://api.hubapi.com/oauth/v1/token"
916
+ }
917
+ },
918
+ intuit: {
919
+ authorizationUrl: "https://appcenter.intuit.com/connect/oauth2",
920
+ isOIDC: true,
921
+ isRefreshable: true,
922
+ profileRequest: {
923
+ authIn: "header",
924
+ encoding: "application/json",
925
+ method: "GET",
926
+ url: (config) => config.environment === "production" ? "https://accounts.platform.intuit.com/v1/openid_connect/userinfo" : "https://sandbox-accounts.platform.intuit.com/v1/openid_connect/userinfo"
927
+ },
928
+ revocationRequest: {
929
+ authIn: "body",
930
+ encoding: "application/json",
931
+ headers: (config) => ({
932
+ Authorization: `Basic ${encodeBase64(`${config.clientId}:${config.clientSecret}`)}`
933
+ }),
934
+ tokenParamName: "token",
935
+ url: "https://developer.api.intuit.com/v2/oauth2/tokens/revoke"
936
+ },
937
+ scopeRequired: true,
938
+ subject: ["id"],
939
+ subjectType: "string",
940
+ tokenRequest: {
941
+ authIn: "body",
942
+ encoding: "application/x-www-form-urlencoded",
943
+ url: "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"
944
+ }
945
+ },
946
+ kakao: {
947
+ authorizationUrl: "https://kauth.kakao.com/oauth/authorize",
948
+ isOIDC: true,
949
+ isRefreshable: true,
950
+ picture: ["picture"],
951
+ PKCEMethod: "S256",
952
+ profileRequest: {
953
+ authIn: "header",
954
+ encoding: "application/json",
955
+ method: "GET",
956
+ url: "https://kapi.kakao.com/v2/user/me"
957
+ },
958
+ scopeRequired: false,
959
+ subject: ["id"],
960
+ subjectType: "string",
961
+ tokenRequest: {
962
+ authIn: "body",
963
+ encoding: "application/x-www-form-urlencoded",
964
+ url: "https://kauth.kakao.com/oauth/token"
965
+ }
966
+ },
967
+ keycloak: {
968
+ authorizationUrl: (config) => `${config.realmURL}/protocol/openid-connect/auth`,
969
+ isOIDC: true,
970
+ isRefreshable: true,
971
+ PKCEMethod: "S256",
972
+ profileRequest: {
973
+ authIn: "header",
974
+ encoding: "application/json",
975
+ method: "GET",
976
+ url: "https://api.kick.com/v1/user"
977
+ },
978
+ revocationRequest: {
979
+ authIn: "body",
980
+ encoding: "application/json",
981
+ tokenParamName: "token",
982
+ url: (config) => `${config.realmURL}/protocol/openid-connect/revoke`
983
+ },
984
+ scopeRequired: false,
985
+ subject: ["id"],
986
+ subjectType: "string",
987
+ tokenRequest: {
988
+ authIn: "body",
989
+ encoding: "application/x-www-form-urlencoded",
990
+ url: (config) => `${config.realmURL}/protocol/openid-connect/token`
991
+ }
992
+ },
993
+ kick: {
994
+ authorizationUrl: "https://id.kick.com/oauth/authorize",
995
+ email: ["data", "email"],
996
+ isOIDC: false,
997
+ isRefreshable: true,
998
+ picture: ["data", "profile_picture"],
999
+ PKCEMethod: "S256",
1000
+ profileRequest: {
1001
+ authIn: "header",
1002
+ encoding: "application/json",
1003
+ method: "GET",
1004
+ url: "https://api.kick.com/public/v1/users"
1005
+ },
1006
+ revocationRequest: {
1007
+ authIn: "body",
1008
+ encoding: "application/json",
1009
+ tokenParamName: "token",
1010
+ url: "https://id.kick.com/oauth/revoke"
1011
+ },
1012
+ scopeRequired: true,
1013
+ subject: ["data", "user_id"],
1014
+ subjectType: "number",
1015
+ tokenRequest: {
1016
+ authIn: "body",
1017
+ encoding: "application/x-www-form-urlencoded",
1018
+ url: "https://id.kick.com/oauth/token"
1019
+ }
1020
+ },
1021
+ lichess: {
1022
+ authorizationUrl: "https://lichess.org/oauth/authorize",
1023
+ isOIDC: false,
1024
+ isRefreshable: false,
1025
+ PKCEMethod: "S256",
1026
+ profileRequest: {
1027
+ authIn: "header",
1028
+ encoding: "application/json",
1029
+ method: "GET",
1030
+ url: "https://lichess.org/api/account"
1031
+ },
1032
+ scopeRequired: false,
1033
+ subject: ["id"],
1034
+ subjectType: "string",
1035
+ tokenRequest: {
1036
+ authIn: "body",
1037
+ encoding: "application/x-www-form-urlencoded",
1038
+ url: "https://lichess.org/api/token"
1039
+ }
1040
+ },
1041
+ line: {
1042
+ authorizationUrl: "https://access.line.me/oauth2/v2.1/authorize",
1043
+ isOIDC: true,
1044
+ isRefreshable: true,
1045
+ PKCEMethod: "S256",
1046
+ profileRequest: {
1047
+ authIn: "header",
1048
+ encoding: "application/json",
1049
+ method: "GET",
1050
+ url: "https://api.line.me/v2/profile"
1051
+ },
1052
+ scopeRequired: true,
1053
+ subject: ["id"],
1054
+ subjectType: "string",
1055
+ tokenRequest: {
1056
+ authIn: "body",
1057
+ encoding: "application/x-www-form-urlencoded",
1058
+ url: "https://api.line.me/oauth2/v2.1/token"
1059
+ }
1060
+ },
1061
+ linear: {
1062
+ authorizationUrl: "https://linear.app/oauth/authorize",
1063
+ isOIDC: false,
1064
+ isRefreshable: false,
1065
+ profileRequest: {
1066
+ authIn: "header",
1067
+ body: {
1068
+ query: `query { viewer { id name } }`
1069
+ },
1070
+ encoding: "application/json",
1071
+ headers: {
1072
+ Accept: "application/json",
1073
+ "Content-Type": "application/json"
1074
+ },
1075
+ method: "POST",
1076
+ url: "https://api.linear.app/graphql"
1077
+ },
1078
+ revocationRequest: {
1079
+ authIn: "header",
1080
+ encoding: "application/json",
1081
+ url: "https://api.linear.app/oauth/revoke"
1082
+ },
1083
+ scopeRequired: false,
1084
+ subject: ["data", "viewer", "id"],
1085
+ subjectType: "string",
1086
+ tokenRequest: {
1087
+ authIn: "body",
1088
+ encoding: "application/x-www-form-urlencoded",
1089
+ url: "https://api.linear.app/oauth/token"
1090
+ }
1091
+ },
1092
+ linkedin: {
1093
+ authorizationUrl: "https://www.linkedin.com/oauth/v2/authorization",
1094
+ isOIDC: true,
1095
+ isRefreshable: true,
1096
+ PKCEMethod: "S256",
1097
+ profileRequest: {
1098
+ authIn: "header",
1099
+ encoding: "application/json",
1100
+ method: "GET",
1101
+ url: "https://api.linkedin.com/v2/me"
1102
+ },
1103
+ scopeRequired: true,
1104
+ subject: ["id"],
1105
+ subjectType: "string",
1106
+ tokenRequest: {
1107
+ authIn: "body",
1108
+ encoding: "application/x-www-form-urlencoded",
1109
+ url: "https://www.linkedin.com/oauth/v2/accessToken"
1110
+ }
1111
+ },
1112
+ mastodon: {
1113
+ authorizationUrl: (config) => `${config.baseURL}/oauth/authorize`,
1114
+ isOIDC: false,
1115
+ isRefreshable: false,
1116
+ picture: ["avatar"],
1117
+ PKCEMethod: "S256",
1118
+ profileRequest: {
1119
+ authIn: "header",
1120
+ encoding: "application/json",
1121
+ method: "GET",
1122
+ url: (config) => `${config.baseURL}/api/v1/accounts/verify_credentials`
1123
+ },
1124
+ revocationRequest: {
1125
+ authIn: "body",
1126
+ encoding: "application/json",
1127
+ tokenParamName: "token",
1128
+ url: (config) => `${config.baseURL}/oauth/revoke`
1129
+ },
1130
+ scopeRequired: false,
1131
+ subject: ["id"],
1132
+ subjectType: "string",
1133
+ tokenRequest: {
1134
+ authIn: "body",
1135
+ encoding: "application/x-www-form-urlencoded",
1136
+ url: (config) => `${config.baseURL}/oauth/token`
1137
+ }
1138
+ },
1139
+ mercadolibre: {
1140
+ authorizationUrl: "https://auth.mercadolibre.com/authorization",
1141
+ isOIDC: false,
1142
+ isRefreshable: true,
1143
+ PKCEMethod: "S256",
1144
+ profileRequest: {
1145
+ authIn: "header",
1146
+ encoding: "application/json",
1147
+ method: "GET",
1148
+ url: "https://api.mercadolibre.com/users/me"
1149
+ },
1150
+ scopeRequired: false,
1151
+ subject: ["id"],
1152
+ subjectType: "number",
1153
+ tokenRequest: {
1154
+ authIn: "body",
1155
+ encoding: "application/x-www-form-urlencoded",
1156
+ url: "https://api.mercadolibre.com/oauth/token"
1157
+ }
1158
+ },
1159
+ mercadopago: {
1160
+ authorizationUrl: "https://auth.mercadopago.com/authorization",
1161
+ isOIDC: false,
1162
+ isRefreshable: true,
1163
+ profileRequest: {
1164
+ authIn: "header",
1165
+ encoding: "application/json",
1166
+ method: "GET",
1167
+ url: "https://api.mercadopago.com/v1/users/me"
1168
+ },
1169
+ scopeRequired: false,
1170
+ subject: ["id"],
1171
+ subjectType: "number",
1172
+ tokenRequest: {
1173
+ authIn: "body",
1174
+ encoding: "application/x-www-form-urlencoded",
1175
+ url: "https://api.mercadopago.com/oauth/token"
1176
+ }
1177
+ },
1178
+ microsoftentraid: {
1179
+ authorizationUrl: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/oauth2/v2.0/authorize`,
1180
+ isOIDC: true,
1181
+ isRefreshable: true,
1182
+ PKCEMethod: "S256",
1183
+ profileRequest: {
1184
+ authIn: "header",
1185
+ encoding: "application/json",
1186
+ method: "GET",
1187
+ url: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/openid/userinfo`
1188
+ },
1189
+ scopeRequired: false,
1190
+ subject: ["id"],
1191
+ subjectType: "string",
1192
+ tokenRequest: {
1193
+ authIn: "body",
1194
+ encoding: "application/x-www-form-urlencoded",
1195
+ url: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/oauth2/v2.0/token`
1196
+ }
1197
+ },
1198
+ monday: {
1199
+ authorizationUrl: "https://auth.monday.com/oauth2/authorize",
1200
+ isOIDC: false,
1201
+ isRefreshable: true,
1202
+ profileRequest: {
1203
+ authIn: "header",
1204
+ body: {
1205
+ query: "query { me { id name email } }"
1206
+ },
1207
+ encoding: "application/json",
1208
+ headers: {
1209
+ "Content-Type": "application/json"
1210
+ },
1211
+ method: "POST",
1212
+ url: "https://api.monday.com/v2"
1213
+ },
1214
+ scopeRequired: true,
1215
+ subject: ["data", "me", "id"],
1216
+ subjectType: "number",
1217
+ tokenRequest: {
1218
+ authIn: "body",
1219
+ encoding: "application/x-www-form-urlencoded",
1220
+ url: "https://auth.monday.com/oauth2/token"
1221
+ }
1222
+ },
1223
+ myanimelist: {
1224
+ authorizationUrl: "https://myanimelist.net/v1/oauth2/authorize",
1225
+ isOIDC: false,
1226
+ isRefreshable: true,
1227
+ PKCEMethod: "plain",
1228
+ profileRequest: {
1229
+ authIn: "header",
1230
+ encoding: "application/json",
1231
+ method: "GET",
1232
+ url: "https://api.myanimelist.net/v2/users/@me"
1233
+ },
1234
+ scopeRequired: false,
1235
+ subject: ["id"],
1236
+ subjectType: "number",
1237
+ tokenRequest: {
1238
+ authIn: "body",
1239
+ encoding: "application/x-www-form-urlencoded",
1240
+ url: "https://myanimelist.net/v1/oauth2/token"
1241
+ }
1242
+ },
1243
+ naver: {
1244
+ authorizationUrl: "https://nid.naver.com/oauth2.0/authorize",
1245
+ email: ["response", "email"],
1246
+ fullName: ["response", "name"],
1247
+ isOIDC: false,
1248
+ isRefreshable: true,
1249
+ picture: ["response", "profile_image"],
1250
+ profileRequest: {
1251
+ authIn: "header",
1252
+ encoding: "application/json",
1253
+ method: "GET",
1254
+ url: "https://openapi.naver.com/v1/nid/me"
1255
+ },
1256
+ scopeRequired: false,
1257
+ subject: ["response", "id"],
1258
+ subjectType: "string",
1259
+ tokenRequest: {
1260
+ authIn: "body",
1261
+ encoding: "application/x-www-form-urlencoded",
1262
+ url: "https://nid.naver.com/oauth2.0/token"
1263
+ }
1264
+ },
1265
+ notion: {
1266
+ authorizationUrl: "https://api.notion.com/v1/oauth/authorize",
1267
+ email: ["bot", "owner", "user", "person", "email"],
1268
+ isOIDC: false,
1269
+ isRefreshable: false,
1270
+ picture: ["bot", "owner", "user", "avatar_url"],
1271
+ profileRequest: {
1272
+ authIn: "header",
1273
+ encoding: "application/json",
1274
+ headers: {
1275
+ "Notion-Version": "2022-06-28"
1276
+ },
1277
+ method: "GET",
1278
+ url: "https://api.notion.com/v1/users/me"
1279
+ },
1280
+ scopeRequired: false,
1281
+ subject: ["bot", "owner", "user", "id"],
1282
+ subjectType: "string",
1283
+ tokenRequest: {
1284
+ authIn: "header",
1285
+ encoding: "application/json",
1286
+ url: "https://api.notion.com/v1/oauth/token"
1287
+ }
1288
+ },
1289
+ okta: {
1290
+ authorizationUrl: (config) => `https://${config.domain}/oauth2/default/v1/authorize`,
1291
+ isOIDC: true,
1292
+ isRefreshable: true,
1293
+ PKCEMethod: "S256",
1294
+ profileRequest: {
1295
+ authIn: "header",
1296
+ encoding: "application/json",
1297
+ method: "GET",
1298
+ url: (config) => `https://${config.domain}/oauth2/default/v1/userinfo`
1299
+ },
1300
+ revocationRequest: {
1301
+ authIn: "body",
1302
+ encoding: "application/json",
1303
+ tokenParamName: "token",
1304
+ url: (config) => `https://${config.domain}/oauth2/default/v1/revoke`
1305
+ },
1306
+ scopeRequired: true,
1307
+ subject: ["id"],
1308
+ subjectType: "string",
1309
+ tokenRequest: {
1310
+ authIn: "body",
1311
+ encoding: "application/x-www-form-urlencoded",
1312
+ url: (config) => `https://${config.domain}/oauth2/default/v1/token`
1313
+ }
1314
+ },
1315
+ osu: {
1316
+ authorizationUrl: "https://osu.ppy.sh/oauth/authorize",
1317
+ isOIDC: false,
1318
+ isRefreshable: true,
1319
+ picture: ["avatar_url"],
1320
+ profileRequest: {
1321
+ authIn: "header",
1322
+ encoding: "application/json",
1323
+ method: "GET",
1324
+ url: "https://osu.ppy.sh/api/v2/me"
1325
+ },
1326
+ scopeRequired: false,
1327
+ subject: ["id"],
1328
+ subjectType: "number",
1329
+ tokenRequest: {
1330
+ authIn: "body",
1331
+ encoding: "application/x-www-form-urlencoded",
1332
+ url: "https://osu.ppy.sh/oauth/token"
1333
+ }
1334
+ },
1335
+ patreon: {
1336
+ authorizationUrl: "https://www.patreon.com/oauth2/authorize",
1337
+ isOIDC: false,
1338
+ isRefreshable: true,
1339
+ profileRequest: {
1340
+ authIn: "header",
1341
+ encoding: "application/json",
1342
+ method: "GET",
1343
+ url: "https://www.patreon.com/api/oauth2/v2/identity"
1344
+ },
1345
+ scopeRequired: false,
1346
+ subject: ["data", "id"],
1347
+ subjectType: "string",
1348
+ tokenRequest: {
1349
+ authIn: "body",
1350
+ encoding: "application/x-www-form-urlencoded",
1351
+ url: "https://www.patreon.com/api/oauth2/token"
1352
+ }
1353
+ },
1354
+ pipedrive: {
1355
+ authorizationUrl: "https://oauth.pipedrive.com/oauth/authorize",
1356
+ isOIDC: false,
1357
+ isRefreshable: true,
1358
+ profileRequest: {
1359
+ authIn: "header",
1360
+ encoding: "application/json",
1361
+ method: "GET",
1362
+ url: "https://api.pipedrive.com/v1/users/me"
1363
+ },
1364
+ scopeRequired: true,
1365
+ subject: ["data", "id"],
1366
+ subjectType: "number",
1367
+ tokenRequest: {
1368
+ authIn: "body",
1369
+ encoding: "application/x-www-form-urlencoded",
1370
+ url: "https://oauth.pipedrive.com/oauth/token"
1371
+ }
1372
+ },
1373
+ polar: {
1374
+ authorizationUrl: "https://polar.sh/oauth2/authorize",
1375
+ isOIDC: true,
1376
+ isRefreshable: true,
1377
+ PKCEMethod: "S256",
1378
+ profileRequest: {
1379
+ authIn: "header",
1380
+ encoding: "application/json",
1381
+ method: "GET",
1382
+ url: "https://api.polar.sh/v1/oauth2/userinfo"
1383
+ },
1384
+ revocationRequest: {
1385
+ authIn: "body",
1386
+ encoding: "application/json",
1387
+ tokenParamName: "token",
1388
+ url: "https://api.polar.sh/v1/oauth2/revoke"
1389
+ },
1390
+ scopeRequired: true,
1391
+ subject: ["id"],
1392
+ subjectType: "string",
1393
+ tokenRequest: {
1394
+ authIn: "body",
1395
+ encoding: "application/x-www-form-urlencoded",
1396
+ url: "https://api.polar.sh/v1/oauth2/token"
1397
+ }
1398
+ },
1399
+ polaraccesslink: {
1400
+ authorizationUrl: "https://flow.polar.com/oauth2/authorization",
1401
+ isOIDC: false,
1402
+ isRefreshable: false,
1403
+ PKCEMethod: "S256",
1404
+ profileRequest: {
1405
+ authIn: "header",
1406
+ encoding: "application/json",
1407
+ method: "GET",
1408
+ url: "https://www.polaraccesslink.com/v3/users/me"
1409
+ },
1410
+ scopeRequired: false,
1411
+ subject: ["x_user_id"],
1412
+ subjectType: "number",
1413
+ tokenRequest: {
1414
+ authIn: "header",
1415
+ encoding: "application/x-www-form-urlencoded",
1416
+ url: "https://polarremote.com/v2/oauth2/token"
1417
+ }
1418
+ },
1419
+ polarteampro: {
1420
+ authorizationUrl: "https://auth.polar.com/oauth/authorize",
1421
+ isOIDC: false,
1422
+ isRefreshable: true,
1423
+ PKCEMethod: "S256",
1424
+ profileRequest: {
1425
+ authIn: "header",
1426
+ encoding: "application/json",
1427
+ method: "GET",
1428
+ url: "https://www.polaraccesslink.com/v3/users/<USER_ID>"
1429
+ },
1430
+ scopeRequired: false,
1431
+ subject: ["x_user_id"],
1432
+ subjectType: "number",
1433
+ tokenRequest: {
1434
+ authIn: "header",
1435
+ encoding: "application/x-www-form-urlencoded",
1436
+ url: "https://auth.polar.com/oauth/token"
1437
+ }
1438
+ },
1439
+ reddit: {
1440
+ authorizationUrl: "https://www.reddit.com/api/v1/authorize",
1441
+ isOIDC: false,
1442
+ isRefreshable: true,
1443
+ profileRequest: {
1444
+ authIn: "header",
1445
+ encoding: "application/json",
1446
+ method: "GET",
1447
+ url: "https://oauth.reddit.com/api/v1/me"
1448
+ },
1449
+ revocationRequest: {
1450
+ authIn: "header",
1451
+ body: new URLSearchParams({
1452
+ token_type_hint: "refresh_token"
1453
+ }),
1454
+ encoding: "application/json",
1455
+ url: "https://www.reddit.com/api/v1/revoke_token"
1456
+ },
1457
+ scopeRequired: true,
1458
+ subject: ["id"],
1459
+ subjectType: "string",
1460
+ tokenRequest: {
1461
+ authIn: "header",
1462
+ encoding: "application/x-www-form-urlencoded",
1463
+ url: "https://www.reddit.com/api/v1/access_token"
1464
+ }
1465
+ },
1466
+ roblox: {
1467
+ authorizationUrl: "https://apis.roblox.com/oauth/v1/authorize",
1468
+ isOIDC: true,
1469
+ isRefreshable: true,
1470
+ picture: ["picture"],
1471
+ PKCEMethod: "S256",
1472
+ profileRequest: {
1473
+ authIn: "header",
1474
+ encoding: "application/json",
1475
+ method: "GET",
1476
+ url: "https://apis.roblox.com/oauth/v1/userinfo"
1477
+ },
1478
+ scopeRequired: true,
1479
+ subject: ["id"],
1480
+ subjectType: "string",
1481
+ tokenRequest: {
1482
+ authIn: "body",
1483
+ encoding: "application/x-www-form-urlencoded",
1484
+ url: "https://apis.roblox.com/oauth/v1/token"
1485
+ }
1486
+ },
1487
+ salesforce: {
1488
+ authorizationUrl: "https://login.salesforce.com/services/oauth2/authorize",
1489
+ isOIDC: true,
1490
+ isRefreshable: true,
1491
+ PKCEMethod: "S256",
1492
+ profileRequest: {
1493
+ authIn: "header",
1494
+ encoding: "application/json",
1495
+ method: "GET",
1496
+ url: "https://login.salesforce.com/services/oauth2/userinfo"
1497
+ },
1498
+ revocationRequest: {
1499
+ authIn: "header",
1500
+ encoding: "application/json",
1501
+ url: "https://login.salesforce.com/services/oauth2/revoke"
1502
+ },
1503
+ scopeRequired: false,
1504
+ subject: ["id"],
1505
+ subjectType: "string",
1506
+ tokenRequest: {
1507
+ authIn: "body",
1508
+ encoding: "application/x-www-form-urlencoded",
1509
+ url: "https://login.salesforce.com/services/oauth2/token"
1510
+ }
1511
+ },
1512
+ shikimori: {
1513
+ authorizationUrl: "https://shikimori.org/oauth/authorize",
1514
+ isOIDC: false,
1515
+ isRefreshable: true,
1516
+ profileRequest: {
1517
+ authIn: "header",
1518
+ encoding: "application/json",
1519
+ method: "GET",
1520
+ url: "https://shikimori.one/api/users/whoami"
1521
+ },
1522
+ scopeRequired: false,
1523
+ subject: ["id"],
1524
+ subjectType: "number",
1525
+ tokenRequest: {
1526
+ authIn: "body",
1527
+ encoding: "application/x-www-form-urlencoded",
1528
+ url: "https://shikimori.org/oauth/token"
1529
+ }
1530
+ },
1531
+ slack: {
1532
+ authorizationUrl: "https://slack.com/openid/connect/authorize",
1533
+ isOIDC: true,
1534
+ isRefreshable: true,
1535
+ profileRequest: {
1536
+ authIn: "query",
1537
+ encoding: "application/json",
1538
+ method: "GET",
1539
+ url: "https://slack.com/api/users.identity"
1540
+ },
1541
+ revocationRequest: {
1542
+ authIn: "body",
1543
+ encoding: "application/json",
1544
+ tokenParamName: "token",
1545
+ url: "https://slack.com/api/auth.revoke"
1546
+ },
1547
+ scopeRequired: true,
1548
+ subject: ["id"],
1549
+ subjectType: "string",
1550
+ tokenRequest: {
1551
+ authIn: "body",
1552
+ encoding: "application/x-www-form-urlencoded",
1553
+ url: "https://slack.com/api/openid.connect.token"
1554
+ }
1555
+ },
1556
+ spotify: {
1557
+ authorizationUrl: "https://accounts.spotify.com/authorize",
1558
+ isOIDC: false,
1559
+ isRefreshable: true,
1560
+ PKCEMethod: "S256",
1561
+ profileRequest: {
1562
+ authIn: "header",
1563
+ encoding: "application/json",
1564
+ method: "GET",
1565
+ url: "https://api.spotify.com/v1/me"
1566
+ },
1567
+ scopeRequired: false,
1568
+ subject: ["id"],
1569
+ subjectType: "string",
1570
+ tokenRequest: {
1571
+ authIn: "body",
1572
+ encoding: "application/x-www-form-urlencoded",
1573
+ url: "https://accounts.spotify.com/api/token"
1574
+ }
1575
+ },
1576
+ startgg: {
1577
+ authorizationUrl: "https://start.gg/oauth/authorize",
1578
+ email: ["data", "currentUser", "email"],
1579
+ isOIDC: false,
1580
+ isRefreshable: true,
1581
+ profileRequest: {
1582
+ authIn: "header",
1583
+ body: {
1584
+ query: `query { currentUser { id slug email player { gamerTag } } }`
1585
+ },
1586
+ encoding: "application/json",
1587
+ headers: {
1588
+ Accept: "application/json",
1589
+ "Content-Type": "application/json"
1590
+ },
1591
+ method: "POST",
1592
+ url: "https://api.start.gg/gql/alpha"
1593
+ },
1594
+ scopeRequired: false,
1595
+ subject: ["data", "currentUser", "id"],
1596
+ subjectType: "number",
1597
+ tokenRequest: {
1598
+ authIn: "body",
1599
+ encoding: "application/x-www-form-urlencoded",
1600
+ url: "https://api.start.gg/oauth/access_token"
1601
+ }
1602
+ },
1603
+ strava: {
1604
+ authorizationUrl: "https://www.strava.com/oauth/authorize",
1605
+ familyName: ["lastname"],
1606
+ givenName: ["firstname"],
1607
+ isOIDC: false,
1608
+ isRefreshable: true,
1609
+ picture: ["profile"],
1610
+ PKCEMethod: "S256",
1611
+ profileRequest: {
1612
+ authIn: "header",
1613
+ encoding: "application/json",
1614
+ method: "GET",
1615
+ url: "https://www.strava.com/api/v3/athlete"
1616
+ },
1617
+ revocationRequest: {
1618
+ authIn: "query",
1619
+ body: new URLSearchParams({
1620
+ token_type_hint: "access_token"
1621
+ }),
1622
+ encoding: "application/json",
1623
+ tokenParamName: "access_token",
1624
+ url: "https://www.strava.com/oauth/deauthorize"
1625
+ },
1626
+ scopeRequired: false,
1627
+ subject: ["id"],
1628
+ subjectType: "number",
1629
+ tokenRequest: {
1630
+ authIn: "body",
1631
+ encoding: "application/x-www-form-urlencoded",
1632
+ url: "https://www.strava.com/oauth/token"
1633
+ }
1634
+ },
1635
+ synology: {
1636
+ authorizationUrl: (config) => `${config.baseURL}/webman/sso/SSOOauth.cgi?client_id=${config.clientId}&response_type=code&redirect_uri=${config.redirectUri}`,
1637
+ isOIDC: false,
1638
+ isRefreshable: false,
1639
+ profileRequest: {
1640
+ authIn: "header",
1641
+ encoding: "application/json",
1642
+ method: "GET",
1643
+ url: (config) => `${config.baseURL}/webman/sso/SSOUserInfo.cgi?client_id=${config.clientId}&access_token=${config.accessToken}`
1644
+ },
1645
+ scopeRequired: false,
1646
+ subject: ["data", "id"],
1647
+ subjectType: "number",
1648
+ tokenRequest: {
1649
+ authIn: "body",
1650
+ encoding: "application/x-www-form-urlencoded",
1651
+ url: (config) => `${config.baseURL}/webman/sso/SSOAccessToken.cgi?client_id=${config.clientId}&client_secret=${config.clientSecret}`
1652
+ }
1653
+ },
1654
+ tiktok: {
1655
+ authorizationUrl: "https://www.tiktok.com/v2/auth/authorize",
1656
+ createAuthorizationURLSearchParams: (config) => ({
1657
+ client_key: config.clientId
1658
+ }),
1659
+ isOIDC: false,
1660
+ isRefreshable: true,
1661
+ PKCEMethod: "S256",
1662
+ profileRequest: {
1663
+ authIn: "query",
1664
+ encoding: "application/json",
1665
+ method: "GET",
1666
+ url: "https://open.douyin.com/oauth/userinfo"
1667
+ },
1668
+ revocationRequest: {
1669
+ authIn: "body",
1670
+ encoding: "application/json",
1671
+ tokenParamName: "token",
1672
+ url: "https://open.tiktokapis.com/v2/oauth/revoke/"
1673
+ },
1674
+ scopeRequired: false,
1675
+ subject: ["data", "open_id"],
1676
+ subjectType: "string",
1677
+ tokenRequest: {
1678
+ authIn: "body",
1679
+ encoding: "application/x-www-form-urlencoded",
1680
+ url: "https://open.tiktokapis.com/v2/oauth/token/"
1681
+ }
1682
+ },
1683
+ tiltify: {
1684
+ authorizationUrl: "https://v5api.tiltify.com/oauth/authorize",
1685
+ isOIDC: false,
1686
+ isRefreshable: true,
1687
+ profileRequest: {
1688
+ authIn: "header",
1689
+ encoding: "application/json",
1690
+ method: "GET",
1691
+ url: "https://v5api.tiltify.com/api/public/current-user"
1692
+ },
1693
+ scopeRequired: false,
1694
+ subject: ["data", "id"],
1695
+ subjectType: "string",
1696
+ tokenRequest: {
1697
+ authIn: "body",
1698
+ encoding: "application/x-www-form-urlencoded",
1699
+ url: "https://v5api.tiltify.com/oauth/token"
1700
+ }
1701
+ },
1702
+ tumblr: {
1703
+ authorizationUrl: "https://www.tumblr.com/oauth2/authorize",
1704
+ isOIDC: false,
1705
+ isRefreshable: true,
1706
+ profileRequest: {
1707
+ authIn: "header",
1708
+ encoding: "application/json",
1709
+ method: "GET",
1710
+ url: "https://api.tumblr.com/v2/user/info"
1711
+ },
1712
+ scopeRequired: false,
1713
+ subject: ["response", "user", "name"],
1714
+ subjectType: "string",
1715
+ tokenRequest: {
1716
+ authIn: "body",
1717
+ encoding: "application/x-www-form-urlencoded",
1718
+ url: "https://api.tumblr.com/v2/oauth2/token"
1719
+ }
1720
+ },
1721
+ twitch: {
1722
+ authorizationUrl: "https://id.twitch.tv/oauth2/authorize",
1723
+ isOIDC: true,
1724
+ isRefreshable: true,
1725
+ profileRequest: {
1726
+ authIn: "header",
1727
+ encoding: "application/json",
1728
+ headers: (config) => ({
1729
+ "Client-Id": config.clientId
1730
+ }),
1731
+ method: "GET",
1732
+ url: "https://api.twitch.tv/helix/users"
1733
+ },
1734
+ revocationRequest: {
1735
+ authIn: "query",
1736
+ encoding: "application/json",
1737
+ headers: (config) => ({
1738
+ "Client-Id": config.clientId
1739
+ }),
1740
+ tokenParamName: "token",
1741
+ url: "https://id.twitch.tv/oauth2/revoke"
1742
+ },
1743
+ scopeRequired: false,
1744
+ subject: ["id"],
1745
+ subjectType: "string",
1746
+ tokenRequest: {
1747
+ authIn: "body",
1748
+ encoding: "application/x-www-form-urlencoded",
1749
+ url: "https://id.twitch.tv/oauth2/token"
1750
+ }
1751
+ },
1752
+ twitter: {
1753
+ authorizationUrl: "https://twitter.com/i/oauth2/authorize",
1754
+ isOIDC: false,
1755
+ isRefreshable: true,
1756
+ PKCEMethod: "S256",
1757
+ profileRequest: {
1758
+ authIn: "header",
1759
+ encoding: "application/json",
1760
+ method: "GET",
1761
+ url: "https://api.twitter.com/2/users/me"
1762
+ },
1763
+ revocationRequest: {
1764
+ authIn: "header",
1765
+ encoding: "application/json",
1766
+ url: "https://api.twitter.com/2/oauth2/revoke"
1767
+ },
1768
+ scopeRequired: false,
1769
+ subject: ["data", "id"],
1770
+ subjectType: "number",
1771
+ tokenRequest: {
1772
+ authIn: "body",
1773
+ encoding: "application/x-www-form-urlencoded",
1774
+ url: "https://api.twitter.com/2/oauth2/token"
1775
+ }
1776
+ },
1777
+ vk: {
1778
+ authorizationUrl: "https://oauth.vk.com/authorize",
1779
+ isOIDC: false,
1780
+ isRefreshable: false,
1781
+ profileRequest: {
1782
+ authIn: "query",
1783
+ encoding: "application/json",
1784
+ method: "GET",
1785
+ url: "https://api.vk.com/method/users.get"
1786
+ },
1787
+ scopeRequired: false,
1788
+ subject: ["response", "0", "id"],
1789
+ subjectType: "number",
1790
+ tokenRequest: {
1791
+ authIn: "body",
1792
+ encoding: "application/x-www-form-urlencoded",
1793
+ url: "https://oauth.vk.com/access_token"
1794
+ }
1795
+ },
1796
+ withings: {
1797
+ authorizationUrl: "https://account.withings.com/oauth2_user/authorize2",
1798
+ isOIDC: false,
1799
+ isRefreshable: true,
1800
+ profileRequest: {
1801
+ authIn: "header",
1802
+ body: async (config) => {
1803
+ const props = await getWithingsProps(config);
1804
+ if (props === undefined)
1805
+ throw new Error("Failed to get Withings search properties");
1806
+ const { nonce, hashedSignature } = props;
1807
+ return [
1808
+ ["action", "getuser"],
1809
+ ["nonce", nonce],
1810
+ ["client_id", config.clientId],
1811
+ ["signature", hashedSignature]
1812
+ ];
1813
+ },
1814
+ encoding: "application/x-www-form-urlencoded",
1815
+ method: "POST",
1816
+ url: "https://wbsapi.withings.net/v2/oauth2"
1817
+ },
1818
+ refreshAccessTokenBody: {
1819
+ action: "requesttoken"
1820
+ },
1821
+ revocationRequest: {
1822
+ authIn: "header",
1823
+ body: async (config) => {
1824
+ const props = await getWithingsProps(config);
1825
+ if (!props)
1826
+ throw new Error("Failed to get Withings props");
1827
+ const { nonce, hashedSignature } = props;
1828
+ return [
1829
+ ["action", "revoke"],
1830
+ ["client_id", config.clientId],
1831
+ ["nonce", nonce],
1832
+ ["signature", hashedSignature]
1833
+ ];
1834
+ },
1835
+ encoding: "application/x-www-form-urlencoded",
1836
+ method: "POST",
1837
+ url: "https://wbsapi.withings.net/v2/oauth2"
1838
+ },
1839
+ scopeRequired: true,
1840
+ subject: ["userid"],
1841
+ subjectType: "string",
1842
+ tokenRequest: {
1843
+ authIn: "body",
1844
+ encoding: "application/x-www-form-urlencoded",
1845
+ url: "https://wbsapi.withings.net/v2/oauth2"
1846
+ },
1847
+ validateAuthorizationCodeBody: {
1848
+ action: "requesttoken"
1849
+ }
1850
+ },
1851
+ workos: {
1852
+ authorizationUrl: (config) => `https://${config.domain}/oauth2/authorize`,
1853
+ createAuthorizationURLSearchParams: () => {
1854
+ const nonce = crypto.randomUUID();
1855
+ return {
1856
+ nonce
1857
+ };
1858
+ },
1859
+ email: ["email"],
1860
+ familyName: ["family_name"],
1861
+ fullName: ["name"],
1862
+ givenName: ["given_name"],
1863
+ isOIDC: true,
1864
+ isRefreshable: true,
1865
+ PKCEMethod: "S256",
1866
+ profileRequest: {
1867
+ authIn: "header",
1868
+ encoding: "application/json",
1869
+ method: "POST",
1870
+ url: (config) => `https://${config.domain}/oauth2/userinfo`
1871
+ },
1872
+ scopeRequired: false,
1873
+ subject: ["id"],
1874
+ subjectType: "string",
1875
+ tokenRequest: {
1876
+ authIn: "body",
1877
+ encoding: "application/x-www-form-urlencoded",
1878
+ url: (config) => `https://${config.domain}/oauth2/token`
1879
+ }
1880
+ },
1881
+ yahoo: {
1882
+ authorizationUrl: "https://api.login.yahoo.com/oauth2/request_auth",
1883
+ isOIDC: true,
1884
+ isRefreshable: true,
1885
+ PKCEMethod: "S256",
1886
+ profileRequest: {
1887
+ authIn: "header",
1888
+ encoding: "application/json",
1889
+ method: "GET",
1890
+ url: "https://api.login.yahoo.com/openid/v1/userinfo"
1891
+ },
1892
+ revocationRequest: {
1893
+ authIn: "header",
1894
+ encoding: "application/json",
1895
+ url: "https://api.login.yahoo.com/oauth2/revoke"
1896
+ },
1897
+ scopeRequired: false,
1898
+ subject: ["id"],
1899
+ subjectType: "string",
1900
+ tokenRequest: {
1901
+ authIn: "body",
1902
+ encoding: "application/x-www-form-urlencoded",
1903
+ url: "https://api.login.yahoo.com/oauth2/get_token"
1904
+ }
1905
+ },
1906
+ yandex: {
1907
+ authorizationUrl: "https://oauth.yandex.com/authorize",
1908
+ createAuthorizationURLSearchParams: {
1909
+ device_id: crypto.randomUUID(),
1910
+ device_name: `${navigator.platform ?? "Unknown"} \u2014 ${(navigator.userAgent.split(")")[0] || "").split("(").pop() || "Unknown"}`
1911
+ },
1912
+ email: ["default_email"],
1913
+ familyName: ["last_name"],
1914
+ fullName: ["real_name"],
1915
+ givenName: ["first_name"],
1916
+ isOIDC: false,
1917
+ isRefreshable: true,
1918
+ PKCEMethod: "S256",
1919
+ profileRequest: {
1920
+ authIn: "header",
1921
+ encoding: "application/json",
1922
+ method: "GET",
1923
+ url: "https://login.yandex.ru/info"
1924
+ },
1925
+ revocationRequest: {
1926
+ authIn: "body",
1927
+ encoding: "application/json",
1928
+ tokenParamName: "access_token",
1929
+ url: "https://oauth.yandex.com/revoke_token"
1930
+ },
1931
+ scopeRequired: false,
1932
+ subject: ["id"],
1933
+ subjectType: "string",
1934
+ tokenRequest: {
1935
+ authIn: "body",
1936
+ encoding: "application/x-www-form-urlencoded",
1937
+ url: "https://oauth.yandex.com/token"
1938
+ }
1939
+ },
1940
+ zoho: {
1941
+ authorizationUrl: (config) => `https://accounts.zoho.${config.region ?? "com"}/oauth/v2/auth`,
1942
+ isOIDC: false,
1943
+ isRefreshable: true,
1944
+ PKCEMethod: "S256",
1945
+ profileRequest: {
1946
+ authIn: "header",
1947
+ encoding: "application/json",
1948
+ method: "GET",
1949
+ url: (config) => `https://accounts.zoho.${config.region ?? "com"}/oauth/user/info`
1950
+ },
1951
+ revocationRequest: {
1952
+ authIn: "query",
1953
+ encoding: "application/x-www-form-urlencoded",
1954
+ tokenParamName: "token",
1955
+ url: (config) => `https://accounts.zoho.${config.region ?? "com"}/oauth/v2/token/revoke`
1956
+ },
1957
+ scopeRequired: true,
1958
+ subject: ["ZUID"],
1959
+ subjectType: "string",
1960
+ tokenRequest: {
1961
+ authIn: "body",
1962
+ encoding: "application/x-www-form-urlencoded",
1963
+ url: (config) => `https://accounts.zoho.${config.region ?? "com"}/oauth/v2/token`
1964
+ }
1965
+ },
1966
+ zoom: {
1967
+ authorizationUrl: "https://zoom.us/oauth/authorize",
1968
+ email: ["email"],
1969
+ familyName: ["last_name"],
1970
+ givenName: ["first_name"],
1971
+ isOIDC: false,
1972
+ isRefreshable: true,
1973
+ picture: ["pic_url"],
1974
+ PKCEMethod: "S256",
1975
+ profileRequest: {
1976
+ authIn: "header",
1977
+ encoding: "application/json",
1978
+ method: "GET",
1979
+ url: "https://api.zoom.us/v2/users/me"
1980
+ },
1981
+ revocationRequest: {
1982
+ authIn: "query",
1983
+ encoding: "application/json",
1984
+ headers: (config) => ({
1985
+ Authorization: `Basic ${btoa(`${config.clientId}:${config.clientSecret}`)}`
1986
+ }),
1987
+ tokenParamName: "token",
1988
+ url: "https://zoom.us/oauth/revoke"
1989
+ },
1990
+ scopeRequired: false,
1991
+ subject: ["id"],
1992
+ subjectType: "string",
1993
+ tokenRequest: {
1994
+ authIn: "body",
1995
+ encoding: "application/x-www-form-urlencoded",
1996
+ url: "https://zoom.us/oauth/token"
1997
+ }
1998
+ }
1999
+ });
2000
+ var isOIDCProviderOption = (option) => {
2001
+ if (!isValidProviderOption(option))
2002
+ return false;
2003
+ const provider = providers[option];
2004
+ return provider.isOIDC;
2005
+ };
2006
+ var isPKCEProviderOption = (option) => {
2007
+ if (!isValidProviderOption(option))
2008
+ return false;
2009
+ const provider = providers[option];
2010
+ return provider.PKCEMethod !== undefined;
2011
+ };
2012
+ var isRefreshableProviderOption = (option) => {
2013
+ if (!isValidProviderOption(option))
2014
+ return false;
2015
+ const provider = providers[option];
2016
+ return provider.isRefreshable;
2017
+ };
2018
+ var isRevocableProviderOption = (option) => {
2019
+ if (!isValidProviderOption(option))
2020
+ return false;
2021
+ const provider = providers[option];
2022
+ return provider.revocationRequest !== undefined;
2023
+ };
2024
+ var isScopeRequiredProviderOption = (option) => {
2025
+ if (!isValidProviderOption(option))
2026
+ return false;
2027
+ const provider = providers[option];
2028
+ return provider.scopeRequired;
2029
+ };
2030
+ var isValidProviderOption = (option) => Object.hasOwn(providers, option);
2031
+ var encodeBase64 = (input) => {
2032
+ let raw;
2033
+ if (typeof input === "string") {
2034
+ raw = input;
2035
+ } else {
2036
+ const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
2037
+ raw = bytes.reduce((acc, byte) => acc + String.fromCharCode(byte), "");
2038
+ }
2039
+ return btoa(raw);
2040
+ };
2041
+ var getWithingsProps = async (config) => {
2042
+ const timestamp = Math.floor(Date.now() / 1000);
2043
+ const signature = `getnonce,${config.clientId},${timestamp}`;
2044
+ const hashedSignature = await hmacSha256(signature, config.clientSecret);
2045
+ const nonceUrl = new URL("https://wbsapi.withings.net/v2/signature");
2046
+ nonceUrl.searchParams.set("action", "getnonce");
2047
+ nonceUrl.searchParams.set("client_id", config.clientId);
2048
+ nonceUrl.searchParams.set("timestamp", timestamp.toString());
2049
+ nonceUrl.searchParams.set("signature", hashedSignature);
2050
+ const nonceTarget = nonceUrl.toString();
2051
+ const nonceResponse = await fetch(nonceTarget, {
2052
+ ...h2IfHttps(nonceTarget),
2053
+ method: "POST"
2054
+ });
2055
+ const nonceData = await nonceResponse.json();
2056
+ if (nonceData.status === 0) {
2057
+ return {
2058
+ hashedSignature,
2059
+ nonce: nonceData.body.nonce
2060
+ };
2061
+ }
2062
+ return;
2063
+ };
2064
+ var h2IfHttps = (url) => {
2065
+ const init = url.startsWith("https://") ? { protocol: "http2" } : {};
2066
+ return init;
2067
+ };
2068
+ var hmacSha256 = async (message, secret) => {
2069
+ const encoder = new TextEncoder;
2070
+ const key = await crypto.subtle.importKey("raw", encoder.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
2071
+ const sigBuffer = await crypto.subtle.sign("HMAC", key, encoder.encode(message));
2072
+ return Array.from(new Uint8Array(sigBuffer)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
2073
+ };
2074
+ var createRandomBase64UrlGenerator = (length) => () => {
2075
+ const buffer = crypto.getRandomValues(new Uint8Array(length));
2076
+ return base64Url(buffer);
2077
+ };
2078
+ var generateCodeVerifier = createRandomBase64UrlGenerator(NUM_GENERATOR_BYTES);
2079
+ var generateState = createRandomBase64UrlGenerator(NUM_GENERATOR_BYTES);
2080
+ var base64Url = (input) => encodeBase64(input).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
2081
+ var oidcProviderOptions = Object.keys(providers).filter(isOIDCProviderOption);
2082
+ var pkceProviderOptions = Object.keys(providers).filter(isPKCEProviderOption);
2083
+ var providerOptions = Object.keys(providers).filter(isValidProviderOption);
2084
+ var refreshableProviderOptions = Object.keys(providers).filter(isRefreshableProviderOption);
2085
+ var revocableProviderOptions = Object.keys(providers).filter(isRevocableProviderOption);
2086
+ var scopeRequiredProviderOptions = Object.keys(providers).filter(isScopeRequiredProviderOption);
2087
+
2088
+ // src/linkedProviders/neonStores.ts
2089
+ var linkedProviderBindingsTable = pgTable6("linked_provider_bindings", {
2090
+ available_scopes: jsonb2("available_scopes").$type().notNull().default([]),
2091
+ capabilities: jsonb2("capabilities").$type().default([]),
2092
+ connector_provider: varchar6("connector_provider", { length: 64 }).notNull(),
2093
+ created_at: timestamp("created_at").notNull().defaultNow(),
2094
+ email: varchar6("email", { length: 320 }),
2095
+ external_account_id: varchar6("external_account_id", {
2096
+ length: 255
2097
+ }).notNull(),
2098
+ external_account_type: varchar6("external_account_type", {
2099
+ length: 64
2100
+ }).notNull(),
2101
+ grant_id: varchar6("grant_id", { length: 255 }).notNull(),
2102
+ id: varchar6("id", { length: 255 }).primaryKey(),
2103
+ label: varchar6("label", { length: 255 }),
2104
+ metadata: jsonb2("metadata").$type().default({}),
2105
+ status: varchar6("status", { length: 64 }).$type().notNull(),
2106
+ updated_at: timestamp("updated_at").notNull().defaultNow(),
2107
+ username: varchar6("username", { length: 255 })
2108
+ });
2109
+ var linkedProviderGrantsTable = pgTable6("linked_provider_grants", {
2110
+ access_token_ciphertext: text3("access_token_ciphertext"),
2111
+ auth_provider_key: varchar6("auth_provider_key", { length: 64 }).notNull(),
2112
+ created_at: timestamp("created_at").notNull().defaultNow(),
2113
+ expires_at: timestamp("expires_at"),
2114
+ granted_scopes: jsonb2("granted_scopes").$type().notNull().default([]),
2115
+ id: varchar6("id", { length: 255 }).primaryKey(),
2116
+ last_refresh_error: text3("last_refresh_error"),
2117
+ last_refreshed_at: timestamp("last_refreshed_at"),
2118
+ metadata: jsonb2("metadata").$type().default({}),
2119
+ owner_ref: varchar6("owner_ref", { length: 255 }).notNull(),
2120
+ provider_family: varchar6("provider_family", { length: 64 }).notNull(),
2121
+ provider_subject: varchar6("provider_subject", { length: 255 }).notNull(),
2122
+ refresh_token_ciphertext: text3("refresh_token_ciphertext"),
2123
+ status: varchar6("status", { length: 64 }).$type().notNull(),
2124
+ token_type: varchar6("token_type", { length: 64 }),
2125
+ updated_at: timestamp("updated_at").notNull().defaultNow()
2126
+ });
2127
+
2128
+ // src/lockout/postgresLockoutStore.ts
2129
+ import { eq as eq7 } from "drizzle-orm";
2130
+ import { bigint as bigint5, integer, pgTable as pgTable7, varchar as varchar7 } from "drizzle-orm/pg-core";
2131
+ var KEY_LENGTH = 320;
2132
+ var lockoutsTable = pgTable7("auth_lockouts", {
2133
+ failed_attempts: integer("failed_attempts").notNull().default(0),
2134
+ key: varchar7("key", { length: KEY_LENGTH }).primaryKey(),
2135
+ locked_until_ms: bigint5("locked_until_ms", { mode: "number" }),
2136
+ window_started_at_ms: bigint5("window_started_at_ms", {
2137
+ mode: "number"
2138
+ }).notNull()
2139
+ });
2140
+
2141
+ // src/mfa/postgresMfaStore.ts
2142
+ import { eq as eq8 } from "drizzle-orm";
2143
+ import {
2144
+ bigint as bigint6,
2145
+ boolean as boolean3,
2146
+ jsonb as jsonb3,
2147
+ pgTable as pgTable8,
2148
+ text as text4,
2149
+ varchar as varchar8
2150
+ } from "drizzle-orm/pg-core";
2151
+ var ID_LENGTH6 = 255;
2152
+ var mfaEnrollmentsTable = pgTable8("auth_mfa_enrollments", {
2153
+ backup_code_hashes: jsonb3("backup_code_hashes").$type().notNull().default([]),
2154
+ created_at_ms: bigint6("created_at_ms", { mode: "number" }).notNull(),
2155
+ last_used_at_ms: bigint6("last_used_at_ms", { mode: "number" }),
2156
+ totp_secret_ciphertext: text4("totp_secret_ciphertext"),
2157
+ totp_verified: boolean3("totp_verified").notNull().default(false),
2158
+ updated_at_ms: bigint6("updated_at_ms", { mode: "number" }).notNull(),
2159
+ user_id: varchar8("user_id", { length: ID_LENGTH6 }).primaryKey()
2160
+ });
2161
+
2162
+ // src/oidc/postgresStores.ts
2163
+ import { and as and3, desc as desc5, eq as eq9, gt, lt as lt3 } from "drizzle-orm";
2164
+ import {
2165
+ bigint as bigint7,
2166
+ boolean as boolean4,
2167
+ jsonb as jsonb4,
2168
+ pgTable as pgTable9,
2169
+ text as text5,
2170
+ varchar as varchar9
2171
+ } from "drizzle-orm/pg-core";
2172
+ var URL_LENGTH = 2048;
2173
+ var ID_LENGTH7 = 255;
2174
+ var oauthClientAssertionJtisTable = pgTable9("auth_oauth_client_assertion_jtis", {
2175
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2176
+ composite_key: varchar9("composite_key", {
2177
+ length: ID_LENGTH7
2178
+ }).primaryKey(),
2179
+ expires_at_ms: bigint7("expires_at_ms", { mode: "number" }).notNull(),
2180
+ jti: varchar9("jti", { length: ID_LENGTH7 }).notNull()
2181
+ });
2182
+ var oauthClientRegistrationTokensTable = pgTable9("auth_oauth_client_registration_tokens", {
2183
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2184
+ created_at_ms: bigint7("created_at_ms", { mode: "number" }).notNull(),
2185
+ token_hash: varchar9("token_hash", { length: ID_LENGTH7 }).primaryKey()
2186
+ });
2187
+ var oauthClientsTable = pgTable9("auth_oauth_clients", {
2188
+ backchannel_logout_uri: varchar9("backchannel_logout_uri", {
2189
+ length: URL_LENGTH
2190
+ }),
2191
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).primaryKey(),
2192
+ hashed_secret: varchar9("hashed_secret", { length: ID_LENGTH7 }),
2193
+ jwks_json: jsonb4("jwks_json").$type(),
2194
+ jwks_uri: varchar9("jwks_uri", { length: URL_LENGTH }),
2195
+ name: varchar9("name", { length: ID_LENGTH7 }).notNull(),
2196
+ post_logout_redirect_uris: text5("post_logout_redirect_uris").array(),
2197
+ redirect_uris: text5("redirect_uris").array().notNull(),
2198
+ require_pushed_authorization_requests: boolean4("require_pushed_authorization_requests"),
2199
+ require_signed_request_object: boolean4("require_signed_request_object"),
2200
+ scopes: text5("scopes").array().notNull()
2201
+ });
2202
+ var oauthCodesTable = pgTable9("auth_oauth_codes", {
2203
+ acr: varchar9("acr", { length: ID_LENGTH7 }),
2204
+ claims_json: jsonb4("claims_json").$type(),
2205
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2206
+ code_challenge: varchar9("code_challenge", { length: ID_LENGTH7 }).notNull(),
2207
+ code_hash: varchar9("code_hash", { length: ID_LENGTH7 }).primaryKey(),
2208
+ created_at_ms: bigint7("created_at_ms", { mode: "number" }).notNull(),
2209
+ dpop_jkt: varchar9("dpop_jkt", { length: ID_LENGTH7 }),
2210
+ expires_at_ms: bigint7("expires_at_ms", { mode: "number" }).notNull(),
2211
+ nonce: varchar9("nonce", { length: ID_LENGTH7 }),
2212
+ redirect_uri: varchar9("redirect_uri", { length: ID_LENGTH7 }).notNull(),
2213
+ scopes: text5("scopes").array().notNull(),
2214
+ user_id: varchar9("user_id", { length: ID_LENGTH7 }).notNull()
2215
+ });
2216
+ var oauthDeviceAuthorizationsTable = pgTable9("auth_oauth_device_authorizations", {
2217
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2218
+ created_at_ms: bigint7("created_at_ms", { mode: "number" }).notNull(),
2219
+ device_code_hash: varchar9("device_code_hash", {
2220
+ length: ID_LENGTH7
2221
+ }).primaryKey(),
2222
+ expires_at_ms: bigint7("expires_at_ms", { mode: "number" }).notNull(),
2223
+ interval_seconds: bigint7("interval_seconds", { mode: "number" }).notNull(),
2224
+ scopes: text5("scopes").array().notNull(),
2225
+ status: varchar9("status", { length: 16 }).notNull(),
2226
+ user_code: varchar9("user_code", { length: 16 }).notNull().unique(),
2227
+ user_sub: varchar9("user_sub", { length: ID_LENGTH7 })
2228
+ });
2229
+ var oauthInitialAccessTokensTable = pgTable9("auth_oauth_initial_access_tokens", {
2230
+ token_hash: varchar9("token_hash", { length: ID_LENGTH7 }).primaryKey()
2231
+ });
2232
+ var oauthLogoutDeliveriesTable = pgTable9("auth_oauth_logout_deliveries", {
2233
+ attempts: bigint7("attempts", { mode: "number" }).notNull(),
2234
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2235
+ created_at_ms: bigint7("created_at_ms", { mode: "number" }).notNull(),
2236
+ endpoint_url: varchar9("endpoint_url", { length: URL_LENGTH }).notNull(),
2237
+ id: varchar9("id", { length: ID_LENGTH7 }).primaryKey(),
2238
+ last_error: text5("last_error"),
2239
+ last_status: bigint7("last_status", { mode: "number" }),
2240
+ logout_token: text5("logout_token").notNull(),
2241
+ user_id: varchar9("user_id", { length: ID_LENGTH7 }).notNull()
2242
+ });
2243
+ var oauthPushedAuthorizationRequestsTable = pgTable9("auth_oauth_pushed_authorization_requests", {
2244
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2245
+ created_at_ms: bigint7("created_at_ms", { mode: "number" }).notNull(),
2246
+ expires_at_ms: bigint7("expires_at_ms", { mode: "number" }).notNull(),
2247
+ params_json: jsonb4("params_json").$type().notNull(),
2248
+ request_uri_hash: varchar9("request_uri_hash", {
2249
+ length: ID_LENGTH7
2250
+ }).primaryKey()
2251
+ });
2252
+ var oauthRefreshTokensTable = pgTable9("auth_oauth_refresh_tokens", {
2253
+ acr: varchar9("acr", { length: ID_LENGTH7 }),
2254
+ claims_json: jsonb4("claims_json").$type(),
2255
+ client_id: varchar9("client_id", { length: ID_LENGTH7 }).notNull(),
2256
+ created_at_ms: bigint7("created_at_ms", { mode: "number" }).notNull(),
2257
+ dpop_jkt: varchar9("dpop_jkt", { length: ID_LENGTH7 }),
2258
+ expires_at_ms: bigint7("expires_at_ms", { mode: "number" }).notNull(),
2259
+ scopes: text5("scopes").array().notNull(),
2260
+ token_hash: varchar9("token_hash", { length: ID_LENGTH7 }).primaryKey(),
2261
+ user_id: varchar9("user_id", { length: ID_LENGTH7 }).notNull()
2262
+ });
2263
+
2264
+ // src/organizations/postgresOrganizationStore.ts
2265
+ import { and as and4, eq as eq10 } from "drizzle-orm";
2266
+ import {
2267
+ bigint as bigint8,
2268
+ jsonb as jsonb5,
2269
+ pgTable as pgTable10,
2270
+ primaryKey as primaryKey2,
2271
+ varchar as varchar10
2272
+ } from "drizzle-orm/pg-core";
2273
+ var ID_LENGTH8 = 255;
2274
+ var NAME_LENGTH = 255;
2275
+ var STATE_LENGTH = 16;
2276
+ var organizationInvitationsTable = pgTable10("auth_organization_invitations", {
2277
+ accepted_at_ms: bigint8("accepted_at_ms", { mode: "number" }),
2278
+ created_at_ms: bigint8("created_at_ms", { mode: "number" }).notNull(),
2279
+ email: varchar10("email", { length: ID_LENGTH8 }).notNull(),
2280
+ expires_at_ms: bigint8("expires_at_ms", { mode: "number" }).notNull(),
2281
+ invitation_id: varchar10("invitation_id", {
2282
+ length: ID_LENGTH8
2283
+ }).primaryKey(),
2284
+ inviter_user_id: varchar10("inviter_user_id", { length: ID_LENGTH8 }),
2285
+ organization_id: varchar10("organization_id", {
2286
+ length: ID_LENGTH8
2287
+ }).notNull(),
2288
+ roles: jsonb5("roles").$type().notNull().default([]),
2289
+ state: varchar10("state", { length: STATE_LENGTH }).$type().notNull().default("pending"),
2290
+ token_hash: varchar10("token_hash", { length: ID_LENGTH8 }).notNull().unique()
2291
+ });
2292
+ var organizationMembershipsTable = pgTable10("auth_organization_memberships", {
2293
+ created_at_ms: bigint8("created_at_ms", { mode: "number" }).notNull(),
2294
+ organization_id: varchar10("organization_id", {
2295
+ length: ID_LENGTH8
2296
+ }).notNull(),
2297
+ roles: jsonb5("roles").$type().notNull().default([]),
2298
+ status: varchar10("status", { length: STATE_LENGTH }).$type().notNull().default("active"),
2299
+ updated_at_ms: bigint8("updated_at_ms", { mode: "number" }).notNull(),
2300
+ user_id: varchar10("user_id", { length: ID_LENGTH8 }).notNull()
2301
+ }, (table) => [primaryKey2({ columns: [table.organization_id, table.user_id] })]);
2302
+ var organizationsTable = pgTable10("auth_organizations", {
2303
+ created_at_ms: bigint8("created_at_ms", { mode: "number" }).notNull(),
2304
+ metadata: jsonb5("metadata").$type(),
2305
+ name: varchar10("name", { length: NAME_LENGTH }).notNull(),
2306
+ organization_id: varchar10("organization_id", {
2307
+ length: ID_LENGTH8
2308
+ }).primaryKey(),
2309
+ updated_at_ms: bigint8("updated_at_ms", { mode: "number" }).notNull()
2310
+ });
2311
+
2312
+ // src/passwordless/postgresPasswordlessTokenStore.ts
2313
+ import { eq as eq11 } from "drizzle-orm";
2314
+ import { bigint as bigint9, pgTable as pgTable11, varchar as varchar11 } from "drizzle-orm/pg-core";
2315
+ var ID_LENGTH9 = 255;
2316
+ var passwordlessTokensTable = pgTable11("auth_passwordless_tokens", {
2317
+ email: varchar11("email", { length: ID_LENGTH9 }).notNull(),
2318
+ expires_at_ms: bigint9("expires_at_ms", { mode: "number" }).notNull(),
2319
+ token_hash: varchar11("token_hash", { length: ID_LENGTH9 }).primaryKey()
2320
+ });
2321
+
2322
+ // src/portal/postgresSetupSessionStore.ts
2323
+ import { eq as eq12 } from "drizzle-orm";
2324
+ import { bigint as bigint10, jsonb as jsonb6, pgTable as pgTable12, varchar as varchar12 } from "drizzle-orm/pg-core";
2325
+ var ID_LENGTH10 = 255;
2326
+ var setupSessionsTable = pgTable12("auth_setup_sessions", {
2327
+ capabilities: jsonb6("capabilities").$type().notNull().default([]),
2328
+ created_at_ms: bigint10("created_at_ms", { mode: "number" }).notNull(),
2329
+ created_by: varchar12("created_by", { length: ID_LENGTH10 }),
2330
+ expires_at_ms: bigint10("expires_at_ms", { mode: "number" }).notNull(),
2331
+ organization_id: varchar12("organization_id", {
2332
+ length: ID_LENGTH10
2333
+ }).notNull(),
2334
+ setup_session_id: varchar12("setup_session_id", {
2335
+ length: ID_LENGTH10
2336
+ }).primaryKey(),
2337
+ token_hash: varchar12("token_hash", { length: ID_LENGTH10 }).notNull().unique()
2338
+ });
2339
+
2340
+ // src/roles/postgresRoleStore.ts
2341
+ import { and as and5, eq as eq13 } from "drizzle-orm";
2342
+ import {
2343
+ bigint as bigint11,
2344
+ jsonb as jsonb7,
2345
+ pgTable as pgTable13,
2346
+ primaryKey as primaryKey3,
2347
+ varchar as varchar13
2348
+ } from "drizzle-orm/pg-core";
2349
+ var ID_LENGTH11 = 255;
2350
+ var SLUG_LENGTH = 128;
2351
+ var GLOBAL_SCOPE = "";
2352
+ var rolesTable = pgTable13("auth_roles", {
2353
+ created_at_ms: bigint11("created_at_ms", { mode: "number" }).notNull(),
2354
+ organization_id: varchar13("organization_id", { length: ID_LENGTH11 }).notNull().default(GLOBAL_SCOPE),
2355
+ permissions: jsonb7("permissions").$type().notNull().default([]),
2356
+ slug: varchar13("slug", { length: SLUG_LENGTH }).notNull(),
2357
+ updated_at_ms: bigint11("updated_at_ms", { mode: "number" }).notNull()
2358
+ }, (table) => [primaryKey3({ columns: [table.organization_id, table.slug] })]);
2359
+
2360
+ // src/scim/postgresScimTokenStore.ts
2361
+ import { desc as desc6, eq as eq14 } from "drizzle-orm";
2362
+ import { bigint as bigint12, pgTable as pgTable14, varchar as varchar14 } from "drizzle-orm/pg-core";
2363
+ var ID_LENGTH12 = 255;
2364
+ var scimTokensTable = pgTable14("auth_scim_tokens", {
2365
+ created_at_ms: bigint12("created_at_ms", { mode: "number" }).notNull(),
2366
+ hashed_token: varchar14("hashed_token", { length: ID_LENGTH12 }).notNull(),
2367
+ last_used_at_ms: bigint12("last_used_at_ms", { mode: "number" }),
2368
+ organization_id: varchar14("organization_id", {
2369
+ length: ID_LENGTH12
2370
+ }).notNull(),
2371
+ token_id: varchar14("token_id", { length: ID_LENGTH12 }).primaryKey()
2372
+ });
2373
+
2374
+ // src/session/neonStore.ts
2375
+ import { neon as neon3 } from "@neondatabase/serverless";
2376
+ import { eq as eq15 } from "drizzle-orm";
2377
+ import { drizzle as drizzle3 } from "drizzle-orm/neon-http";
2378
+ import {
2379
+ bigint as bigint13,
2380
+ jsonb as jsonb8,
2381
+ pgTable as pgTable15,
2382
+ text as text6,
2383
+ timestamp as timestamp2,
2384
+ varchar as varchar15
2385
+ } from "drizzle-orm/pg-core";
2386
+ var authSessionsTable = pgTable15("auth_sessions", {
2387
+ access_token: text6("access_token"),
2388
+ authenticated_at_ms: bigint13("authenticated_at_ms", { mode: "number" }),
2389
+ created_at: timestamp2("created_at").notNull().defaultNow(),
2390
+ expires_at_ms: bigint13("expires_at_ms", { mode: "number" }).notNull(),
2391
+ id: varchar15("id", { length: 255 }).primaryKey(),
2392
+ refresh_token: text6("refresh_token"),
2393
+ updated_at: timestamp2("updated_at").notNull().defaultNow(),
2394
+ user_json: jsonb8("user_json").$type().notNull()
2395
+ });
2396
+ var authUnregisteredSessionsTable = pgTable15("auth_unregistered_sessions", {
2397
+ access_token: text6("access_token"),
2398
+ created_at: timestamp2("created_at").notNull().defaultNow(),
2399
+ expires_at_ms: bigint13("expires_at_ms", { mode: "number" }).notNull(),
2400
+ id: varchar15("id", { length: 255 }).primaryKey(),
2401
+ refresh_token: text6("refresh_token"),
2402
+ session_information_json: jsonb8("session_information_json").$type(),
2403
+ updated_at: timestamp2("updated_at").notNull().defaultNow(),
2404
+ user_identity_json: jsonb8("user_identity_json").$type()
2405
+ });
2406
+
2407
+ // src/sso/postgresSamlServiceProviderStore.ts
2408
+ import { eq as eq16 } from "drizzle-orm";
2409
+ import { bigint as bigint14, pgTable as pgTable16, text as text7, varchar as varchar16 } from "drizzle-orm/pg-core";
2410
+ var ID_LENGTH13 = 255;
2411
+ var URL_LENGTH2 = 2048;
2412
+ var samlServiceProvidersTable = pgTable16("auth_saml_service_providers", {
2413
+ acs_url: varchar16("acs_url", { length: URL_LENGTH2 }).notNull(),
2414
+ created_at_ms: bigint14("created_at_ms", { mode: "number" }).notNull(),
2415
+ entity_id: varchar16("entity_id", { length: URL_LENGTH2 }).primaryKey(),
2416
+ name_id_format: varchar16("name_id_format", { length: ID_LENGTH13 }),
2417
+ signing_cert: text7("signing_cert"),
2418
+ updated_at_ms: bigint14("updated_at_ms", { mode: "number" }).notNull()
2419
+ });
2420
+
2421
+ // src/sso/postgresSsoConnectionStore.ts
2422
+ import { and as and6, desc as desc7, eq as eq17 } from "drizzle-orm";
2423
+ import { bigint as bigint15, boolean as boolean5, jsonb as jsonb9, pgTable as pgTable17, varchar as varchar17 } from "drizzle-orm/pg-core";
2424
+ var ID_LENGTH14 = 255;
2425
+ var TYPE_LENGTH2 = 16;
2426
+ var ssoConnectionsTable = pgTable17("auth_sso_connections", {
2427
+ config: jsonb9("config").$type().notNull(),
2428
+ connection_id: varchar17("connection_id", { length: ID_LENGTH14 }).primaryKey(),
2429
+ created_at_ms: bigint15("created_at_ms", { mode: "number" }).notNull(),
2430
+ enabled: boolean5("enabled").notNull().default(true),
2431
+ organization_id: varchar17("organization_id", {
2432
+ length: ID_LENGTH14
2433
+ }).notNull(),
2434
+ type: varchar17("type", { length: TYPE_LENGTH2 }).$type().notNull(),
2435
+ updated_at_ms: bigint15("updated_at_ms", { mode: "number" }).notNull()
2436
+ });
2437
+
2438
+ // src/vault/postgresVaultStore.ts
2439
+ import { and as and7, eq as eq18 } from "drizzle-orm";
2440
+ import { bigint as bigint16, pgTable as pgTable18, primaryKey as primaryKey4, text as text8, varchar as varchar18 } from "drizzle-orm/pg-core";
2441
+ var ID_LENGTH15 = 255;
2442
+ var vaultEntriesTable = pgTable18("auth_vault_entries", {
2443
+ created_at_ms: bigint16("created_at_ms", { mode: "number" }).notNull(),
2444
+ encrypted_value: text8("encrypted_value").notNull(),
2445
+ name: varchar18("name", { length: ID_LENGTH15 }).notNull(),
2446
+ owner_id: varchar18("owner_id", { length: ID_LENGTH15 }).notNull(),
2447
+ updated_at_ms: bigint16("updated_at_ms", { mode: "number" }).notNull()
2448
+ }, (table) => ({ pk: primaryKey4({ columns: [table.owner_id, table.name] }) }));
2449
+
2450
+ // src/webauthn/postgresWebAuthnCredentialStore.ts
2451
+ import { eq as eq19 } from "drizzle-orm";
2452
+ import {
2453
+ bigint as bigint17,
2454
+ boolean as boolean6,
2455
+ jsonb as jsonb10,
2456
+ pgTable as pgTable19,
2457
+ text as text9,
2458
+ varchar as varchar19
2459
+ } from "drizzle-orm/pg-core";
2460
+ var ID_LENGTH16 = 255;
2461
+ var DEVICE_TYPE_LENGTH = 32;
2462
+ var webauthnCredentialsTable = pgTable19("auth_webauthn_credentials", {
2463
+ backed_up: boolean6("backed_up"),
2464
+ counter: bigint17("counter", { mode: "number" }).notNull().default(0),
2465
+ created_at_ms: bigint17("created_at_ms", { mode: "number" }).notNull(),
2466
+ credential_id: varchar19("credential_id", { length: ID_LENGTH16 }).primaryKey(),
2467
+ device_type: varchar19("device_type", { length: DEVICE_TYPE_LENGTH }),
2468
+ last_used_at_ms: bigint17("last_used_at_ms", { mode: "number" }),
2469
+ public_key: text9("public_key").notNull(),
2470
+ transports: jsonb10("transports").$type(),
2471
+ user_id: varchar19("user_id", { length: ID_LENGTH16 }).notNull()
2472
+ });
2473
+
2474
+ // src/webhooks/postgresStore.ts
2475
+ import { desc as desc8, eq as eq20 } from "drizzle-orm";
2476
+ import { bigint as bigint18, jsonb as jsonb11, pgTable as pgTable20, text as text10, varchar as varchar20 } from "drizzle-orm/pg-core";
2477
+ var ID_LENGTH17 = 255;
2478
+ var URL_LENGTH3 = 2048;
2479
+ var webhookDeliveriesTable = pgTable20("auth_webhook_deliveries", {
2480
+ attempts: bigint18("attempts", { mode: "number" }).notNull(),
2481
+ created_at_ms: bigint18("created_at_ms", { mode: "number" }).notNull(),
2482
+ endpoint_url: varchar20("endpoint_url", { length: URL_LENGTH3 }).notNull(),
2483
+ envelope_id: varchar20("envelope_id", { length: ID_LENGTH17 }).primaryKey(),
2484
+ envelope_json: jsonb11("envelope_json").$type().notNull(),
2485
+ last_error: text10("last_error"),
2486
+ last_status: bigint18("last_status", { mode: "number" })
2487
+ });
2488
+
2489
+ // src/migrations/generate.ts
2490
+ import { is, SQL } from "drizzle-orm";
2491
+ import {
2492
+ getTableConfig
2493
+ } from "drizzle-orm/pg-core";
2494
+ var renderChunk = (chunk) => {
2495
+ if (chunk === null || typeof chunk !== "object")
2496
+ return String(chunk);
2497
+ const value = Reflect.get(chunk, "value");
2498
+ if (Array.isArray(value))
2499
+ return value.map((part) => String(part)).join("");
2500
+ return "";
2501
+ };
2502
+ var formatSqlTemplate = (value) => value.queryChunks.map(renderChunk).join("");
2503
+ var formatDefault = (value) => {
2504
+ if (value === null || value === undefined)
2505
+ return "NULL";
2506
+ if (is(value, SQL))
2507
+ return formatSqlTemplate(value);
2508
+ if (typeof value === "string")
2509
+ return `'${value.replace(/'/gu, "''")}'`;
2510
+ if (typeof value === "boolean")
2511
+ return value ? "true" : "false";
2512
+ if (typeof value === "number")
2513
+ return String(value);
2514
+ if (Array.isArray(value) || typeof value === "object") {
2515
+ return `'${JSON.stringify(value)}'::jsonb`;
2516
+ }
2517
+ return String(value);
2518
+ };
2519
+ var columnSql = (column) => {
2520
+ const parts = [`"${column.name}"`, column.getSQLType()];
2521
+ if (column.primary)
2522
+ parts.push("PRIMARY KEY");
2523
+ if (column.notNull && !column.primary)
2524
+ parts.push("NOT NULL");
2525
+ if (column.hasDefault && column.default !== undefined) {
2526
+ parts.push(`DEFAULT ${formatDefault(column.default)}`);
2527
+ }
2528
+ if (column.isUnique)
2529
+ parts.push("UNIQUE");
2530
+ return parts.join(" ");
2531
+ };
2532
+ var compositePkLine = (compositePk) => `PRIMARY KEY (${compositePk.map((column) => `"${column.name}"`).join(", ")})`;
2533
+ var tableToCreateSql = (table) => {
2534
+ const cfg = getTableConfig(table);
2535
+ const columnLines = cfg.columns.map(columnSql);
2536
+ const singlePk = cfg.columns.find((column) => column.primary);
2537
+ const compositePk = cfg.primaryKeys[0]?.columns ?? [];
2538
+ const lines = singlePk === undefined && compositePk.length > 0 ? [...columnLines, compositePkLine(compositePk)] : columnLines;
2539
+ const body = lines.map((line) => ` ${line}`).join(`,
2540
+ `);
2541
+ return `CREATE TABLE IF NOT EXISTS "${cfg.name}" (
2542
+ ${body}
2543
+ );`;
2544
+ };
2545
+ var tablesToInitSql = (tables) => tables.map(tableToCreateSql).join(`
2546
+
2547
+ `);
2548
+
2549
+ // src/migrations/runner.ts
2550
+ import { Pool } from "@neondatabase/serverless";
2551
+ var JOURNAL_DDL = `CREATE TABLE IF NOT EXISTS "auth_migrations" (
2552
+ "id" text PRIMARY KEY,
2553
+ "applied_at_ms" bigint NOT NULL
2554
+ );`;
2555
+ var isJournalRow = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "id") === "string";
2556
+ var allBlockNames = () => Object.keys(blockMigrations);
2557
+ var applyOne = async (pool, id, sql, log) => {
2558
+ await pool.query(sql);
2559
+ await pool.query(`INSERT INTO "auth_migrations" ("id", "applied_at_ms") VALUES ($1, $2)`, [id, Date.now()]);
2560
+ log(`apply ${id}`);
2561
+ };
2562
+ var runOne = async (pool, id, sql, applied, result, log) => {
2563
+ if (applied.has(id)) {
2564
+ result.skipped.push(id);
2565
+ log(`skip ${id}`);
2566
+ return;
2567
+ }
2568
+ await applyOne(pool, id, sql, log);
2569
+ result.applied.push(id);
2570
+ };
2571
+ var runMigrations = async ({
2572
+ blocks,
2573
+ databaseUrl,
2574
+ log = console.log
2575
+ }) => {
2576
+ const pool = new Pool({ connectionString: databaseUrl });
2577
+ const result = { applied: [], skipped: [] };
2578
+ try {
2579
+ await pool.query(JOURNAL_DDL);
2580
+ const journal = await pool.query(`SELECT "id" FROM "auth_migrations"`);
2581
+ const applied = new Set(journal.rows.filter(isJournalRow).map((row) => row.id));
2582
+ const selected = blocks ?? allBlockNames();
2583
+ const flat = selected.flatMap((block) => blockMigrations[block].migrations.map((migration) => ({
2584
+ id: `${block}/${migration.id}`,
2585
+ sql: migration.sql
2586
+ })));
2587
+ await flat.reduce(async (prior, item) => {
2588
+ await prior;
2589
+ return runOne(pool, item.id, item.sql, applied, result, log);
2590
+ }, Promise.resolve());
2591
+ } finally {
2592
+ await pool.end();
2593
+ }
2594
+ return result;
2595
+ };
2596
+
2597
+ // src/migrations/index.ts
2598
+ var initMigration = (block, tables) => ({
2599
+ block,
2600
+ migrations: [{ id: "0001_init", sql: tablesToInitSql(tables) }]
2601
+ });
2602
+ var blockMigrations = {
2603
+ adaptive: initMigration("adaptive", [knownDevicesTable, loginHistoryTable]),
2604
+ apikeys: initMigration("apikeys", [
2605
+ accessTokensTable,
2606
+ apiClientsTable,
2607
+ apiKeysTable
2608
+ ]),
2609
+ audit: initMigration("audit", [auditEventsTable]),
2610
+ credentials: initMigration("credentials", [
2611
+ credentialsTable,
2612
+ credentialResetTokensTable,
2613
+ credentialVerificationTokensTable
2614
+ ]),
2615
+ fga: initMigration("fga", [warrantsTable]),
2616
+ linkedProviders: initMigration("linkedProviders", [
2617
+ linkedProviderBindingsTable,
2618
+ linkedProviderGrantsTable
2619
+ ]),
2620
+ lockout: initMigration("lockout", [lockoutsTable]),
2621
+ mfa: initMigration("mfa", [mfaEnrollmentsTable]),
2622
+ oidc: initMigration("oidc", [
2623
+ oauthClientAssertionJtisTable,
2624
+ oauthClientRegistrationTokensTable,
2625
+ oauthClientsTable,
2626
+ oauthCodesTable,
2627
+ oauthDeviceAuthorizationsTable,
2628
+ oauthInitialAccessTokensTable,
2629
+ oauthLogoutDeliveriesTable,
2630
+ oauthPushedAuthorizationRequestsTable,
2631
+ oauthRefreshTokensTable
2632
+ ]),
2633
+ organizations: initMigration("organizations", [
2634
+ organizationsTable,
2635
+ organizationMembershipsTable,
2636
+ organizationInvitationsTable
2637
+ ]),
2638
+ passwordless: initMigration("passwordless", [passwordlessTokensTable]),
2639
+ portal: initMigration("portal", [setupSessionsTable]),
2640
+ roles: initMigration("roles", [rolesTable]),
2641
+ scim: initMigration("scim", [scimTokensTable]),
2642
+ sessions: initMigration("sessions", [
2643
+ authSessionsTable,
2644
+ authUnregisteredSessionsTable
2645
+ ]),
2646
+ sso: initMigration("sso", [ssoConnectionsTable, samlServiceProvidersTable]),
2647
+ vault: initMigration("vault", [vaultEntriesTable]),
2648
+ webauthn: initMigration("webauthn", [webauthnCredentialsTable]),
2649
+ webhooks: initMigration("webhooks", [webhookDeliveriesTable])
2650
+ };
2651
+
2652
+ // src/cli/migrate.ts
2653
+ var USAGE = `Usage:
2654
+ bunx absolute-auth migrate --db <url> [--blocks block1,block2,...]
2655
+
2656
+ Options:
2657
+ --db, --database-url Postgres connection string (falls back to DATABASE_URL env)
2658
+ --blocks Comma-separated subset of blocks to apply (default: all)
2659
+ --help Print this message
2660
+
2661
+ Available blocks: ${Object.keys(blockMigrations).sort().join(", ")}
2662
+ `;
2663
+ var consumeFlag = (parsed, flag, args) => {
2664
+ if (flag === "--help" || flag === "-h") {
2665
+ parsed.help = true;
2666
+ } else if (flag === "--db" || flag === "--database-url") {
2667
+ parsed.databaseUrl = args.shift();
2668
+ } else if (flag === "--blocks") {
2669
+ const list = args.shift() ?? "";
2670
+ parsed.blocks = list.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0).map((entry) => entry);
2671
+ }
2672
+ };
2673
+ var parseArgs = (argv) => {
2674
+ const parsed = {
2675
+ blocks: undefined,
2676
+ databaseUrl: undefined,
2677
+ help: false
2678
+ };
2679
+ const args = [...argv];
2680
+ while (args.length > 0) {
2681
+ consumeFlag(parsed, args.shift(), args);
2682
+ }
2683
+ return parsed;
2684
+ };
2685
+ var die = (message) => {
2686
+ process.stderr.write(`error: ${message}
2687
+
2688
+ `);
2689
+ process.stderr.write(USAGE);
2690
+ process.exit(1);
2691
+ };
2692
+ var main = async () => {
2693
+ const positional = process.argv.slice(2);
2694
+ if (positional[0] === "migrate")
2695
+ positional.shift();
2696
+ const { blocks, databaseUrl, help } = parseArgs(positional);
2697
+ if (help) {
2698
+ process.stdout.write(USAGE);
2699
+ return;
2700
+ }
2701
+ const resolved = databaseUrl ?? process.env["DATABASE_URL"];
2702
+ if (resolved === undefined || resolved.length === 0) {
2703
+ die("a Postgres URL is required (--db or DATABASE_URL)");
2704
+ return;
2705
+ }
2706
+ const unknown = blocks?.filter((block) => !(block in blockMigrations)) ?? [];
2707
+ if (unknown.length > 0) {
2708
+ die(`unknown block(s): ${unknown.join(", ")}`);
2709
+ return;
2710
+ }
2711
+ const result = await runMigrations({ blocks, databaseUrl: resolved });
2712
+ process.stdout.write(`
2713
+ ${result.applied.length} migration(s) applied, ${result.skipped.length} skipped.
2714
+ `);
2715
+ };
2716
+ await main();
2717
+
2718
+ //# debugId=562323D9670B702364756E2164756E21
2719
+ //# sourceMappingURL=migrate.js.map