@absolutejs/auth 0.14.5 → 0.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +363 -530
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,132 +2,6 @@
|
|
|
2
2
|
// node_modules/citra/dist/index.js
|
|
3
3
|
var NUM_GENERATOR_BYTES = 32;
|
|
4
4
|
var BASE64_BLOCK_SIZE = 4;
|
|
5
|
-
var createOAuth2FetchError = async (response) => {
|
|
6
|
-
const clone = response.clone();
|
|
7
|
-
const prefix = `HTTP ${response.status} ${response.statusText} for ${response.url}`;
|
|
8
|
-
const payload = await response.json().catch(() => null);
|
|
9
|
-
if (payload && typeof payload === "object" && Object.keys(payload).length) {
|
|
10
|
-
return new Error(`${prefix}
|
|
11
|
-
${JSON.stringify(payload)}`);
|
|
12
|
-
}
|
|
13
|
-
const text = await clone.text().catch(() => "");
|
|
14
|
-
if (text) {
|
|
15
|
-
return new Error(`${prefix}
|
|
16
|
-
${text}`);
|
|
17
|
-
}
|
|
18
|
-
return new Error(prefix);
|
|
19
|
-
};
|
|
20
|
-
var encodeBase64 = (input) => {
|
|
21
|
-
let raw;
|
|
22
|
-
if (typeof input === "string") {
|
|
23
|
-
raw = input;
|
|
24
|
-
} else {
|
|
25
|
-
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
26
|
-
raw = bytes.reduce((acc, byte) => acc + String.fromCharCode(byte), "");
|
|
27
|
-
}
|
|
28
|
-
return btoa(raw);
|
|
29
|
-
};
|
|
30
|
-
var decodeBase64 = (input, toUint8Array = false) => {
|
|
31
|
-
const b64 = input.replace(/-/g, "+").replace(/_/g, "/") + "==".slice(0, (BASE64_BLOCK_SIZE - input.length % BASE64_BLOCK_SIZE) % BASE64_BLOCK_SIZE);
|
|
32
|
-
const raw = atob(b64);
|
|
33
|
-
if (!toUint8Array) {
|
|
34
|
-
return raw;
|
|
35
|
-
}
|
|
36
|
-
const bytes = new Uint8Array(raw.length);
|
|
37
|
-
for (let i = 0;i < raw.length; i++) {
|
|
38
|
-
bytes[i] = raw.charCodeAt(i);
|
|
39
|
-
}
|
|
40
|
-
return bytes;
|
|
41
|
-
};
|
|
42
|
-
var hmacSha256 = async (message, secret) => {
|
|
43
|
-
const encoder = new TextEncoder;
|
|
44
|
-
const key = await crypto.subtle.importKey("raw", encoder.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
|
|
45
|
-
const sigBuffer = await crypto.subtle.sign("HMAC", key, encoder.encode(message));
|
|
46
|
-
return Array.from(new Uint8Array(sigBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
47
|
-
};
|
|
48
|
-
var decodeJWT = (tokenString) => {
|
|
49
|
-
const [headerSegment, payloadSegment, signatureSegment] = tokenString.split(".");
|
|
50
|
-
if (!headerSegment || !payloadSegment || !signatureSegment) {
|
|
51
|
-
throw new Error("Invalid JWT format");
|
|
52
|
-
}
|
|
53
|
-
const decodedPayload = decodeBase64(payloadSegment);
|
|
54
|
-
if (typeof decodedPayload !== "string") {
|
|
55
|
-
throw new Error("Expected JWT payload to be a UTF-8 string");
|
|
56
|
-
}
|
|
57
|
-
return JSON.parse(decodedPayload);
|
|
58
|
-
};
|
|
59
|
-
var getWithingsProps = async (config) => {
|
|
60
|
-
const timestamp = Math.floor(Date.now() / 1000);
|
|
61
|
-
const signature = `getnonce,${config.clientId},${timestamp}`;
|
|
62
|
-
const hashedSignature = await hmacSha256(signature, config.clientSecret);
|
|
63
|
-
const nonceUrl = new URL("https://wbsapi.withings.net/v2/signature");
|
|
64
|
-
nonceUrl.searchParams.set("action", "getnonce");
|
|
65
|
-
nonceUrl.searchParams.set("client_id", config.clientId);
|
|
66
|
-
nonceUrl.searchParams.set("timestamp", timestamp.toString());
|
|
67
|
-
nonceUrl.searchParams.set("signature", hashedSignature);
|
|
68
|
-
const nonceResponse = await fetch(nonceUrl.toString(), {
|
|
69
|
-
method: "POST"
|
|
70
|
-
});
|
|
71
|
-
const nonceData = await nonceResponse.json();
|
|
72
|
-
if (nonceData.status === 0) {
|
|
73
|
-
return {
|
|
74
|
-
hashedSignature,
|
|
75
|
-
nonce: nonceData.body.nonce
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
79
|
-
};
|
|
80
|
-
var createOAuth2Request = ({
|
|
81
|
-
url,
|
|
82
|
-
body,
|
|
83
|
-
authIn,
|
|
84
|
-
headers,
|
|
85
|
-
encoding,
|
|
86
|
-
clientId,
|
|
87
|
-
clientSecret
|
|
88
|
-
}) => {
|
|
89
|
-
const oauthHeaders = new Headers(headers);
|
|
90
|
-
oauthHeaders.set("Accept", "application/json");
|
|
91
|
-
oauthHeaders.set("User-Agent", "citra");
|
|
92
|
-
if (authIn === "header") {
|
|
93
|
-
if (!clientSecret) {
|
|
94
|
-
throw new Error("clientSecret required for header auth");
|
|
95
|
-
}
|
|
96
|
-
oauthHeaders.set("Authorization", `Basic ${encodeBase64(`${clientId}:${clientSecret}`)}`);
|
|
97
|
-
}
|
|
98
|
-
if (encoding === "application/json") {
|
|
99
|
-
oauthHeaders.set("Content-Type", "application/json");
|
|
100
|
-
return new Request(url, {
|
|
101
|
-
body: JSON.stringify(body),
|
|
102
|
-
headers: oauthHeaders,
|
|
103
|
-
method: "POST"
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
oauthHeaders.set("Content-Type", "application/x-www-form-urlencoded");
|
|
107
|
-
const entries = body instanceof URLSearchParams ? Array.from(body.entries()) : Object.entries(body).filter((entry) => typeof entry[1] === "string");
|
|
108
|
-
const params = new URLSearchParams(entries);
|
|
109
|
-
if (authIn === "body") {
|
|
110
|
-
params.set("client_id", clientId);
|
|
111
|
-
clientSecret && params.set("client_secret", clientSecret);
|
|
112
|
-
}
|
|
113
|
-
return new Request(url, {
|
|
114
|
-
body: params.toString(),
|
|
115
|
-
headers: oauthHeaders,
|
|
116
|
-
method: "POST"
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
var createS256CodeChallenge = async (codeVerifier) => {
|
|
120
|
-
const data = new TextEncoder().encode(codeVerifier);
|
|
121
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
122
|
-
return base64Url(hashBuffer);
|
|
123
|
-
};
|
|
124
|
-
var createRandomBase64UrlGenerator = (length) => () => {
|
|
125
|
-
const buffer = crypto.getRandomValues(new Uint8Array(length));
|
|
126
|
-
return base64Url(buffer);
|
|
127
|
-
};
|
|
128
|
-
var generateCodeVerifier = createRandomBase64UrlGenerator(NUM_GENERATOR_BYTES);
|
|
129
|
-
var generateState = createRandomBase64UrlGenerator(NUM_GENERATOR_BYTES);
|
|
130
|
-
var base64Url = (input) => encodeBase64(input).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
131
5
|
var anilistProfileQuery = `query {
|
|
132
6
|
Viewer {
|
|
133
7
|
id
|
|
@@ -235,71 +109,10 @@ var anilistProfileQuery = `query {
|
|
|
235
109
|
isFollowing
|
|
236
110
|
}
|
|
237
111
|
}`;
|
|
238
|
-
var
|
|
239
|
-
var isRefreshableProviderOption = (option) => {
|
|
240
|
-
if (!isValidProviderOption(option))
|
|
241
|
-
return false;
|
|
242
|
-
const provider = providers[option];
|
|
243
|
-
return provider.isRefreshable;
|
|
244
|
-
};
|
|
245
|
-
var isRevocableProviderOption = (option) => {
|
|
246
|
-
if (!isValidProviderOption(option))
|
|
247
|
-
return false;
|
|
248
|
-
const provider = providers[option];
|
|
249
|
-
return provider.revocationRequest !== undefined;
|
|
250
|
-
};
|
|
251
|
-
var isPKCEProviderOption = (option) => {
|
|
252
|
-
if (!isValidProviderOption(option))
|
|
253
|
-
return false;
|
|
254
|
-
const provider = providers[option];
|
|
255
|
-
return provider.PKCEMethod !== undefined;
|
|
256
|
-
};
|
|
257
|
-
var isOIDCProviderOption = (option) => {
|
|
258
|
-
if (!isValidProviderOption(option))
|
|
259
|
-
return false;
|
|
260
|
-
const provider = providers[option];
|
|
261
|
-
return provider.isOIDC;
|
|
262
|
-
};
|
|
263
|
-
var isScopeRequiredProviderOption = (option) => {
|
|
264
|
-
if (!isValidProviderOption(option))
|
|
265
|
-
return false;
|
|
266
|
-
const provider = providers[option];
|
|
267
|
-
return provider.scopeRequired;
|
|
268
|
-
};
|
|
269
|
-
var isRefreshableOAuth2Client = (providerName, client) => isRefreshableProviderOption(providerName);
|
|
270
|
-
var isRevocableOAuth2Client = (providerName, client) => isRevocableProviderOption(providerName);
|
|
271
|
-
var hasClientSecret = (credentials) => {
|
|
272
|
-
if (typeof credentials !== "object" || credentials === null)
|
|
273
|
-
return false;
|
|
274
|
-
const secret = Reflect.get(credentials, "clientSecret");
|
|
275
|
-
return typeof secret === "string";
|
|
276
|
-
};
|
|
277
|
-
var isObject = (x) => x !== null && typeof x === "object" && !Array.isArray(x) && Object.prototype.toString.call(x) === "[object Object]";
|
|
278
|
-
var extractPropFromIdentity = (identity, keys) => {
|
|
279
|
-
let value = identity;
|
|
280
|
-
for (const key of keys) {
|
|
281
|
-
if (Array.isArray(value)) {
|
|
282
|
-
value = value[0];
|
|
283
|
-
}
|
|
284
|
-
if (!isObject(value)) {
|
|
285
|
-
throw new Error(`Invalid identity data shape: expected object, got ${typeof value}`);
|
|
286
|
-
}
|
|
287
|
-
value = value[key];
|
|
288
|
-
}
|
|
289
|
-
return value;
|
|
290
|
-
};
|
|
291
|
-
var extractSubFromOIDCIdentity = (identity) => {
|
|
292
|
-
const sub = extractPropFromIdentity(identity, ["sub"]);
|
|
293
|
-
if (typeof sub !== "string") {
|
|
294
|
-
throw new Error("Invalid identity data shape");
|
|
295
|
-
}
|
|
296
|
-
return sub;
|
|
297
|
-
};
|
|
298
|
-
var defineProviders = (providers2) => providers2;
|
|
112
|
+
var defineProviders = (providers) => providers;
|
|
299
113
|
var providers = defineProviders({
|
|
300
114
|
"42": {
|
|
301
115
|
authorizationUrl: "https://api.intra.42.fr/oauth/authorize",
|
|
302
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
303
116
|
isOIDC: false,
|
|
304
117
|
isRefreshable: true,
|
|
305
118
|
profileRequest: {
|
|
@@ -309,6 +122,8 @@ var providers = defineProviders({
|
|
|
309
122
|
url: "https://api.intra.42.fr/v2/me"
|
|
310
123
|
},
|
|
311
124
|
scopeRequired: false,
|
|
125
|
+
subject: ["sub"],
|
|
126
|
+
subjectType: "string",
|
|
312
127
|
tokenRequest: {
|
|
313
128
|
authIn: "body",
|
|
314
129
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -317,7 +132,6 @@ var providers = defineProviders({
|
|
|
317
132
|
},
|
|
318
133
|
amazoncognito: {
|
|
319
134
|
authorizationUrl: "https://${domain}/oauth2/authorize",
|
|
320
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
321
135
|
isOIDC: true,
|
|
322
136
|
isRefreshable: true,
|
|
323
137
|
PKCEMethod: "S256",
|
|
@@ -334,6 +148,8 @@ var providers = defineProviders({
|
|
|
334
148
|
url: (config) => `https://${config.domain}/oauth2/revoke`
|
|
335
149
|
},
|
|
336
150
|
scopeRequired: false,
|
|
151
|
+
subject: ["sub"],
|
|
152
|
+
subjectType: "string",
|
|
337
153
|
tokenRequest: {
|
|
338
154
|
authIn: "body",
|
|
339
155
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -342,17 +158,6 @@ var providers = defineProviders({
|
|
|
342
158
|
},
|
|
343
159
|
anilist: {
|
|
344
160
|
authorizationUrl: "https://anilist.co/api/v2/oauth/authorize",
|
|
345
|
-
extractSubjectFromIdentity(identity) {
|
|
346
|
-
const subject = extractPropFromIdentity(identity, [
|
|
347
|
-
"data",
|
|
348
|
-
"Viewer",
|
|
349
|
-
"id"
|
|
350
|
-
]);
|
|
351
|
-
if (typeof subject !== "number") {
|
|
352
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
353
|
-
}
|
|
354
|
-
return subject;
|
|
355
|
-
},
|
|
356
161
|
isOIDC: false,
|
|
357
162
|
isRefreshable: true,
|
|
358
163
|
profileRequest: {
|
|
@@ -369,6 +174,8 @@ var providers = defineProviders({
|
|
|
369
174
|
url: "https://graphql.anilist.co"
|
|
370
175
|
},
|
|
371
176
|
scopeRequired: false,
|
|
177
|
+
subject: ["data", "Viewer", "id"],
|
|
178
|
+
subjectType: "number",
|
|
372
179
|
tokenRequest: {
|
|
373
180
|
authIn: "body",
|
|
374
181
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -377,7 +184,6 @@ var providers = defineProviders({
|
|
|
377
184
|
},
|
|
378
185
|
apple: {
|
|
379
186
|
authorizationUrl: "https://appleid.apple.com/auth/authorize",
|
|
380
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
381
187
|
isOIDC: true,
|
|
382
188
|
isRefreshable: true,
|
|
383
189
|
PKCEMethod: "S256",
|
|
@@ -388,6 +194,8 @@ var providers = defineProviders({
|
|
|
388
194
|
url: "https://appleid.apple.com/auth/userinfo"
|
|
389
195
|
},
|
|
390
196
|
scopeRequired: false,
|
|
197
|
+
subject: ["sub"],
|
|
198
|
+
subjectType: "string",
|
|
391
199
|
tokenRequest: {
|
|
392
200
|
authIn: "body",
|
|
393
201
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -399,15 +207,11 @@ var providers = defineProviders({
|
|
|
399
207
|
createAuthorizationURLSearchParams: {
|
|
400
208
|
audience: "api.atlassian.com"
|
|
401
209
|
},
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (typeof subject !== "number") {
|
|
405
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
406
|
-
}
|
|
407
|
-
return subject;
|
|
408
|
-
},
|
|
210
|
+
email: ["email"],
|
|
211
|
+
fullName: ["name"],
|
|
409
212
|
isOIDC: false,
|
|
410
213
|
isRefreshable: true,
|
|
214
|
+
picture: ["picture"],
|
|
411
215
|
profileRequest: {
|
|
412
216
|
authIn: "header",
|
|
413
217
|
encoding: "application/json",
|
|
@@ -415,6 +219,8 @@ var providers = defineProviders({
|
|
|
415
219
|
url: "https://api.atlassian.com/me"
|
|
416
220
|
},
|
|
417
221
|
scopeRequired: true,
|
|
222
|
+
subject: ["account_id"],
|
|
223
|
+
subjectType: "string",
|
|
418
224
|
tokenRequest: {
|
|
419
225
|
authIn: "body",
|
|
420
226
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -423,7 +229,6 @@ var providers = defineProviders({
|
|
|
423
229
|
},
|
|
424
230
|
auth0: {
|
|
425
231
|
authorizationUrl: (config) => `https://${config.domain}/authorize`,
|
|
426
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
427
232
|
isOIDC: true,
|
|
428
233
|
isRefreshable: true,
|
|
429
234
|
PKCEMethod: "S256",
|
|
@@ -443,6 +248,8 @@ var providers = defineProviders({
|
|
|
443
248
|
url: (config) => `https://${config.domain}/oauth/revoke`
|
|
444
249
|
},
|
|
445
250
|
scopeRequired: false,
|
|
251
|
+
subject: ["sub"],
|
|
252
|
+
subjectType: "string",
|
|
446
253
|
tokenRequest: {
|
|
447
254
|
authIn: "body",
|
|
448
255
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -451,7 +258,6 @@ var providers = defineProviders({
|
|
|
451
258
|
},
|
|
452
259
|
authentik: {
|
|
453
260
|
authorizationUrl: (config) => `https://${config.baseURL}/oauth/authorize`,
|
|
454
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
455
261
|
isOIDC: true,
|
|
456
262
|
isRefreshable: true,
|
|
457
263
|
PKCEMethod: "S256",
|
|
@@ -462,6 +268,8 @@ var providers = defineProviders({
|
|
|
462
268
|
url: (config) => `https://${config.baseURL}/api/v3/user/`
|
|
463
269
|
},
|
|
464
270
|
scopeRequired: false,
|
|
271
|
+
subject: ["sub"],
|
|
272
|
+
subjectType: "string",
|
|
465
273
|
tokenRequest: {
|
|
466
274
|
authIn: "body",
|
|
467
275
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -470,9 +278,13 @@ var providers = defineProviders({
|
|
|
470
278
|
},
|
|
471
279
|
autodesk: {
|
|
472
280
|
authorizationUrl: "https://developer.api.autodesk.com/authentication/v2/authorize",
|
|
473
|
-
|
|
281
|
+
email: ["email"],
|
|
282
|
+
familyName: ["family_name"],
|
|
283
|
+
fullName: ["name"],
|
|
284
|
+
givenName: ["given_name"],
|
|
474
285
|
isOIDC: true,
|
|
475
286
|
isRefreshable: true,
|
|
287
|
+
picture: ["picture"],
|
|
476
288
|
PKCEMethod: "S256",
|
|
477
289
|
profileRequest: {
|
|
478
290
|
authIn: "header",
|
|
@@ -481,6 +293,8 @@ var providers = defineProviders({
|
|
|
481
293
|
url: "https://api.userprofile.autodesk.com/userinfo"
|
|
482
294
|
},
|
|
483
295
|
scopeRequired: false,
|
|
296
|
+
subject: ["sub"],
|
|
297
|
+
subjectType: "string",
|
|
484
298
|
tokenRequest: {
|
|
485
299
|
authIn: "body",
|
|
486
300
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -489,7 +303,6 @@ var providers = defineProviders({
|
|
|
489
303
|
},
|
|
490
304
|
battlenet: {
|
|
491
305
|
authorizationUrl: "https://oauth.battle.net/authorize",
|
|
492
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
493
306
|
isOIDC: true,
|
|
494
307
|
isRefreshable: false,
|
|
495
308
|
profileRequest: {
|
|
@@ -499,6 +312,8 @@ var providers = defineProviders({
|
|
|
499
312
|
url: "https://oauth.battle.net/userinfo"
|
|
500
313
|
},
|
|
501
314
|
scopeRequired: false,
|
|
315
|
+
subject: ["sub"],
|
|
316
|
+
subjectType: "string",
|
|
502
317
|
tokenRequest: {
|
|
503
318
|
authIn: "body",
|
|
504
319
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -507,15 +322,10 @@ var providers = defineProviders({
|
|
|
507
322
|
},
|
|
508
323
|
bitbucket: {
|
|
509
324
|
authorizationUrl: "https://bitbucket.org/site/oauth2/authorize",
|
|
510
|
-
|
|
511
|
-
const subject = extractPropFromIdentity(identity, ["uuid"]);
|
|
512
|
-
if (typeof subject !== "number") {
|
|
513
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
514
|
-
}
|
|
515
|
-
return subject;
|
|
516
|
-
},
|
|
325
|
+
fullName: ["display_name"],
|
|
517
326
|
isOIDC: false,
|
|
518
327
|
isRefreshable: true,
|
|
328
|
+
picture: ["links", "avatar", "href"],
|
|
519
329
|
profileRequest: {
|
|
520
330
|
authIn: "header",
|
|
521
331
|
encoding: "application/json",
|
|
@@ -523,6 +333,8 @@ var providers = defineProviders({
|
|
|
523
333
|
url: "https://api.bitbucket.org/2.0/user"
|
|
524
334
|
},
|
|
525
335
|
scopeRequired: false,
|
|
336
|
+
subject: ["uuid"],
|
|
337
|
+
subjectType: "string",
|
|
526
338
|
tokenRequest: {
|
|
527
339
|
authIn: "body",
|
|
528
340
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -531,15 +343,11 @@ var providers = defineProviders({
|
|
|
531
343
|
},
|
|
532
344
|
box: {
|
|
533
345
|
authorizationUrl: "https://account.box.com/api/oauth2/authorize",
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
if (typeof subject !== "number") {
|
|
537
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
538
|
-
}
|
|
539
|
-
return subject;
|
|
540
|
-
},
|
|
346
|
+
email: ["login"],
|
|
347
|
+
fullName: ["name"],
|
|
541
348
|
isOIDC: false,
|
|
542
349
|
isRefreshable: true,
|
|
350
|
+
picture: ["avatar_url"],
|
|
543
351
|
profileRequest: {
|
|
544
352
|
authIn: "header",
|
|
545
353
|
encoding: "application/json",
|
|
@@ -553,6 +361,8 @@ var providers = defineProviders({
|
|
|
553
361
|
url: "https://api.box.com/oauth2/revoke"
|
|
554
362
|
},
|
|
555
363
|
scopeRequired: false,
|
|
364
|
+
subject: ["id"],
|
|
365
|
+
subjectType: "string",
|
|
556
366
|
tokenRequest: {
|
|
557
367
|
authIn: "body",
|
|
558
368
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -561,16 +371,6 @@ var providers = defineProviders({
|
|
|
561
371
|
},
|
|
562
372
|
bungie: {
|
|
563
373
|
authorizationUrl: "https://www.bungie.net/en/OAuth/Authorize",
|
|
564
|
-
extractSubjectFromIdentity(identity) {
|
|
565
|
-
const subject = extractPropFromIdentity(identity, [
|
|
566
|
-
"Response",
|
|
567
|
-
"membershipId"
|
|
568
|
-
]);
|
|
569
|
-
if (typeof subject !== "number") {
|
|
570
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
571
|
-
}
|
|
572
|
-
return subject;
|
|
573
|
-
},
|
|
574
374
|
isOIDC: false,
|
|
575
375
|
isRefreshable: true,
|
|
576
376
|
profileRequest: {
|
|
@@ -583,6 +383,8 @@ var providers = defineProviders({
|
|
|
583
383
|
url: "https://www.bungie.net/Platform/User/GetCurrentBungieNetUser"
|
|
584
384
|
},
|
|
585
385
|
scopeRequired: false,
|
|
386
|
+
subject: ["Response", "membershipId"],
|
|
387
|
+
subjectType: "number",
|
|
586
388
|
tokenRequest: {
|
|
587
389
|
authIn: "body",
|
|
588
390
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -591,13 +393,6 @@ var providers = defineProviders({
|
|
|
591
393
|
},
|
|
592
394
|
coinbase: {
|
|
593
395
|
authorizationUrl: "https://www.coinbase.com/oauth/authorize",
|
|
594
|
-
extractSubjectFromIdentity(identity) {
|
|
595
|
-
const subject = extractPropFromIdentity(identity, ["data", "id"]);
|
|
596
|
-
if (typeof subject !== "number") {
|
|
597
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
598
|
-
}
|
|
599
|
-
return subject;
|
|
600
|
-
},
|
|
601
396
|
isOIDC: false,
|
|
602
397
|
isRefreshable: true,
|
|
603
398
|
profileRequest: {
|
|
@@ -607,6 +402,8 @@ var providers = defineProviders({
|
|
|
607
402
|
url: "https://api.coinbase.com/v2/user"
|
|
608
403
|
},
|
|
609
404
|
scopeRequired: false,
|
|
405
|
+
subject: ["data", "id"],
|
|
406
|
+
subjectType: "number",
|
|
610
407
|
tokenRequest: {
|
|
611
408
|
authIn: "body",
|
|
612
409
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -615,9 +412,10 @@ var providers = defineProviders({
|
|
|
615
412
|
},
|
|
616
413
|
discord: {
|
|
617
414
|
authorizationUrl: "https://discord.com/api/oauth2/authorize",
|
|
618
|
-
|
|
415
|
+
email: ["email"],
|
|
619
416
|
isOIDC: true,
|
|
620
417
|
isRefreshable: true,
|
|
418
|
+
picture: ["avatar"],
|
|
621
419
|
PKCEMethod: "S256",
|
|
622
420
|
profileRequest: {
|
|
623
421
|
authIn: "header",
|
|
@@ -626,6 +424,8 @@ var providers = defineProviders({
|
|
|
626
424
|
url: "https://discord.com/api/users/@me"
|
|
627
425
|
},
|
|
628
426
|
scopeRequired: true,
|
|
427
|
+
subject: ["sub"],
|
|
428
|
+
subjectType: "string",
|
|
629
429
|
tokenRequest: {
|
|
630
430
|
authIn: "body",
|
|
631
431
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -634,15 +434,10 @@ var providers = defineProviders({
|
|
|
634
434
|
},
|
|
635
435
|
donationalerts: {
|
|
636
436
|
authorizationUrl: "https://www.donationalerts.com/oauth/authorize",
|
|
637
|
-
|
|
638
|
-
const subject = extractPropFromIdentity(identity, ["data", "id"]);
|
|
639
|
-
if (typeof subject !== "number") {
|
|
640
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
641
|
-
}
|
|
642
|
-
return subject;
|
|
643
|
-
},
|
|
437
|
+
email: ["data", "email"],
|
|
644
438
|
isOIDC: false,
|
|
645
439
|
isRefreshable: true,
|
|
440
|
+
picture: ["data", "avatar"],
|
|
646
441
|
profileRequest: {
|
|
647
442
|
authIn: "header",
|
|
648
443
|
encoding: "application/json",
|
|
@@ -650,6 +445,8 @@ var providers = defineProviders({
|
|
|
650
445
|
url: "https://www.donationalerts.com/api/v1/user/oauth"
|
|
651
446
|
},
|
|
652
447
|
scopeRequired: false,
|
|
448
|
+
subject: ["data", "id"],
|
|
449
|
+
subjectType: "number",
|
|
653
450
|
tokenRequest: {
|
|
654
451
|
authIn: "body",
|
|
655
452
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -658,13 +455,6 @@ var providers = defineProviders({
|
|
|
658
455
|
},
|
|
659
456
|
dribbble: {
|
|
660
457
|
authorizationUrl: "https://dribbble.com/oauth/authorize",
|
|
661
|
-
extractSubjectFromIdentity(identity) {
|
|
662
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
663
|
-
if (typeof subject !== "number") {
|
|
664
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
665
|
-
}
|
|
666
|
-
return subject;
|
|
667
|
-
},
|
|
668
458
|
isOIDC: false,
|
|
669
459
|
isRefreshable: false,
|
|
670
460
|
profileRequest: {
|
|
@@ -674,6 +464,8 @@ var providers = defineProviders({
|
|
|
674
464
|
url: "https://api.dribbble.com/v2/user"
|
|
675
465
|
},
|
|
676
466
|
scopeRequired: false,
|
|
467
|
+
subject: ["id"],
|
|
468
|
+
subjectType: "number",
|
|
677
469
|
tokenRequest: {
|
|
678
470
|
authIn: "body",
|
|
679
471
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -682,13 +474,10 @@ var providers = defineProviders({
|
|
|
682
474
|
},
|
|
683
475
|
dropbox: {
|
|
684
476
|
authorizationUrl: "https://www.dropbox.com/oauth2/authorize",
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
return subject;
|
|
691
|
-
},
|
|
477
|
+
email: ["email"],
|
|
478
|
+
familyName: ["name", "surname"],
|
|
479
|
+
fullName: ["name", "display_name"],
|
|
480
|
+
givenName: ["name", "given_name"],
|
|
692
481
|
isOIDC: false,
|
|
693
482
|
isRefreshable: true,
|
|
694
483
|
profileRequest: {
|
|
@@ -703,6 +492,8 @@ var providers = defineProviders({
|
|
|
703
492
|
url: "https://api.dropboxapi.com/2/auth/token/revoke"
|
|
704
493
|
},
|
|
705
494
|
scopeRequired: false,
|
|
495
|
+
subject: ["account_id"],
|
|
496
|
+
subjectType: "string",
|
|
706
497
|
tokenRequest: {
|
|
707
498
|
authIn: "body",
|
|
708
499
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -711,13 +502,6 @@ var providers = defineProviders({
|
|
|
711
502
|
},
|
|
712
503
|
epicgames: {
|
|
713
504
|
authorizationUrl: "https://www.epicgames.com/id/authorize",
|
|
714
|
-
extractSubjectFromIdentity(identity) {
|
|
715
|
-
const subject = extractPropFromIdentity(identity, ["account_id"]);
|
|
716
|
-
if (typeof subject !== "number") {
|
|
717
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
718
|
-
}
|
|
719
|
-
return subject;
|
|
720
|
-
},
|
|
721
505
|
isOIDC: false,
|
|
722
506
|
isRefreshable: true,
|
|
723
507
|
profileRequest: {
|
|
@@ -727,6 +511,8 @@ var providers = defineProviders({
|
|
|
727
511
|
url: "https://api.epicgames.dev/epic/oauth/v2/userInfo"
|
|
728
512
|
},
|
|
729
513
|
scopeRequired: false,
|
|
514
|
+
subject: ["account_id"],
|
|
515
|
+
subjectType: "number",
|
|
730
516
|
tokenRequest: {
|
|
731
517
|
authIn: "body",
|
|
732
518
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -735,17 +521,6 @@ var providers = defineProviders({
|
|
|
735
521
|
},
|
|
736
522
|
etsy: {
|
|
737
523
|
authorizationUrl: "https://www.etsy.com/oauth/connect",
|
|
738
|
-
extractSubjectFromIdentity(identity) {
|
|
739
|
-
const subject = extractPropFromIdentity(identity, [
|
|
740
|
-
"results",
|
|
741
|
-
"0",
|
|
742
|
-
"user_id"
|
|
743
|
-
]);
|
|
744
|
-
if (typeof subject !== "number") {
|
|
745
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
746
|
-
}
|
|
747
|
-
return subject;
|
|
748
|
-
},
|
|
749
524
|
isOIDC: false,
|
|
750
525
|
isRefreshable: true,
|
|
751
526
|
profileRequest: {
|
|
@@ -755,6 +530,8 @@ var providers = defineProviders({
|
|
|
755
530
|
url: "https://openapi.etsy.com/v3/application/users/me"
|
|
756
531
|
},
|
|
757
532
|
scopeRequired: false,
|
|
533
|
+
subject: ["results", "0", "user_id"],
|
|
534
|
+
subjectType: "number",
|
|
758
535
|
tokenRequest: {
|
|
759
536
|
authIn: "body",
|
|
760
537
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -763,9 +540,13 @@ var providers = defineProviders({
|
|
|
763
540
|
},
|
|
764
541
|
facebook: {
|
|
765
542
|
authorizationUrl: "https://www.facebook.com/v16.0/dialog/oauth",
|
|
766
|
-
|
|
543
|
+
email: ["email"],
|
|
544
|
+
familyName: ["family_name"],
|
|
545
|
+
fullName: ["name"],
|
|
546
|
+
givenName: ["given_name"],
|
|
767
547
|
isOIDC: true,
|
|
768
548
|
isRefreshable: false,
|
|
549
|
+
picture: ["picture"],
|
|
769
550
|
PKCEMethod: "S256",
|
|
770
551
|
profileRequest: {
|
|
771
552
|
authIn: "query",
|
|
@@ -775,6 +556,8 @@ var providers = defineProviders({
|
|
|
775
556
|
url: "https://graph.facebook.com/me"
|
|
776
557
|
},
|
|
777
558
|
scopeRequired: false,
|
|
559
|
+
subject: ["sub"],
|
|
560
|
+
subjectType: "string",
|
|
778
561
|
tokenRequest: {
|
|
779
562
|
authIn: "body",
|
|
780
563
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -783,15 +566,10 @@ var providers = defineProviders({
|
|
|
783
566
|
},
|
|
784
567
|
figma: {
|
|
785
568
|
authorizationUrl: "https://www.figma.com/oauth",
|
|
786
|
-
|
|
787
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
788
|
-
if (typeof subject !== "string") {
|
|
789
|
-
throw new Error(`Invalid identity data shape: expected string, got ${typeof subject}`);
|
|
790
|
-
}
|
|
791
|
-
return subject;
|
|
792
|
-
},
|
|
569
|
+
email: ["email"],
|
|
793
570
|
isOIDC: false,
|
|
794
571
|
isRefreshable: true,
|
|
572
|
+
picture: ["img_url"],
|
|
795
573
|
PKCEMethod: "S256",
|
|
796
574
|
profileRequest: {
|
|
797
575
|
authIn: "header",
|
|
@@ -800,6 +578,8 @@ var providers = defineProviders({
|
|
|
800
578
|
url: "https://api.figma.com/v1/me"
|
|
801
579
|
},
|
|
802
580
|
scopeRequired: true,
|
|
581
|
+
subject: ["id"],
|
|
582
|
+
subjectType: "string",
|
|
803
583
|
tokenRequest: {
|
|
804
584
|
authIn: "body",
|
|
805
585
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -808,7 +588,6 @@ var providers = defineProviders({
|
|
|
808
588
|
},
|
|
809
589
|
gitea: {
|
|
810
590
|
authorizationUrl: (config) => `${config.baseURL}/login/oauth/authorize`,
|
|
811
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
812
591
|
isOIDC: true,
|
|
813
592
|
isRefreshable: true,
|
|
814
593
|
PKCEMethod: "S256",
|
|
@@ -819,6 +598,8 @@ var providers = defineProviders({
|
|
|
819
598
|
url: (config) => `${config.baseURL}/api/v1/user`
|
|
820
599
|
},
|
|
821
600
|
scopeRequired: false,
|
|
601
|
+
subject: ["sub"],
|
|
602
|
+
subjectType: "string",
|
|
822
603
|
tokenRequest: {
|
|
823
604
|
authIn: "body",
|
|
824
605
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -827,15 +608,10 @@ var providers = defineProviders({
|
|
|
827
608
|
},
|
|
828
609
|
github: {
|
|
829
610
|
authorizationUrl: "https://github.com/login/oauth/authorize",
|
|
830
|
-
|
|
831
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
832
|
-
if (typeof subject !== "number") {
|
|
833
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
834
|
-
}
|
|
835
|
-
return subject;
|
|
836
|
-
},
|
|
611
|
+
email: ["email"],
|
|
837
612
|
isOIDC: false,
|
|
838
613
|
isRefreshable: false,
|
|
614
|
+
picture: ["avatar_url"],
|
|
839
615
|
profileRequest: {
|
|
840
616
|
authIn: "header",
|
|
841
617
|
encoding: "application/json",
|
|
@@ -843,6 +619,8 @@ var providers = defineProviders({
|
|
|
843
619
|
url: "https://api.github.com/user"
|
|
844
620
|
},
|
|
845
621
|
scopeRequired: false,
|
|
622
|
+
subject: ["id"],
|
|
623
|
+
subjectType: "number",
|
|
846
624
|
tokenRequest: {
|
|
847
625
|
authIn: "body",
|
|
848
626
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -851,9 +629,11 @@ var providers = defineProviders({
|
|
|
851
629
|
},
|
|
852
630
|
gitlab: {
|
|
853
631
|
authorizationUrl: (config) => `${config.baseURL}/oauth/authorize`,
|
|
854
|
-
|
|
632
|
+
email: ["email"],
|
|
633
|
+
fullName: ["name"],
|
|
855
634
|
isOIDC: true,
|
|
856
635
|
isRefreshable: true,
|
|
636
|
+
picture: ["picture"],
|
|
857
637
|
PKCEMethod: "S256",
|
|
858
638
|
profileRequest: {
|
|
859
639
|
authIn: "header",
|
|
@@ -868,6 +648,8 @@ var providers = defineProviders({
|
|
|
868
648
|
url: (config) => `${config.baseURL}/oauth/revoke`
|
|
869
649
|
},
|
|
870
650
|
scopeRequired: false,
|
|
651
|
+
subject: ["sub"],
|
|
652
|
+
subjectType: "string",
|
|
871
653
|
tokenRequest: {
|
|
872
654
|
authIn: "body",
|
|
873
655
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -876,9 +658,12 @@ var providers = defineProviders({
|
|
|
876
658
|
},
|
|
877
659
|
google: {
|
|
878
660
|
authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
879
|
-
|
|
661
|
+
familyName: ["family_name"],
|
|
662
|
+
fullName: ["name"],
|
|
663
|
+
givenName: ["given_name"],
|
|
880
664
|
isOIDC: true,
|
|
881
665
|
isRefreshable: true,
|
|
666
|
+
picture: ["picture"],
|
|
882
667
|
PKCEMethod: "S256",
|
|
883
668
|
profileRequest: {
|
|
884
669
|
authIn: "header",
|
|
@@ -894,6 +679,8 @@ var providers = defineProviders({
|
|
|
894
679
|
url: "https://oauth2.googleapis.com/revoke"
|
|
895
680
|
},
|
|
896
681
|
scopeRequired: true,
|
|
682
|
+
subject: ["sub"],
|
|
683
|
+
subjectType: "string",
|
|
897
684
|
tokenRequest: {
|
|
898
685
|
authIn: "body",
|
|
899
686
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -902,7 +689,6 @@ var providers = defineProviders({
|
|
|
902
689
|
},
|
|
903
690
|
intuit: {
|
|
904
691
|
authorizationUrl: "https://appcenter.intuit.com/connect/oauth2",
|
|
905
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
906
692
|
isOIDC: true,
|
|
907
693
|
isRefreshable: true,
|
|
908
694
|
profileRequest: {
|
|
@@ -921,6 +707,8 @@ var providers = defineProviders({
|
|
|
921
707
|
url: "https://developer.api.intuit.com/v2/oauth2/tokens/revoke"
|
|
922
708
|
},
|
|
923
709
|
scopeRequired: true,
|
|
710
|
+
subject: ["sub"],
|
|
711
|
+
subjectType: "string",
|
|
924
712
|
tokenRequest: {
|
|
925
713
|
authIn: "body",
|
|
926
714
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -929,9 +717,9 @@ var providers = defineProviders({
|
|
|
929
717
|
},
|
|
930
718
|
kakao: {
|
|
931
719
|
authorizationUrl: "https://kauth.kakao.com/oauth/authorize",
|
|
932
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
933
720
|
isOIDC: true,
|
|
934
721
|
isRefreshable: true,
|
|
722
|
+
picture: ["picture"],
|
|
935
723
|
PKCEMethod: "S256",
|
|
936
724
|
profileRequest: {
|
|
937
725
|
authIn: "header",
|
|
@@ -940,6 +728,8 @@ var providers = defineProviders({
|
|
|
940
728
|
url: "https://kapi.kakao.com/v2/user/me"
|
|
941
729
|
},
|
|
942
730
|
scopeRequired: false,
|
|
731
|
+
subject: ["sub"],
|
|
732
|
+
subjectType: "string",
|
|
943
733
|
tokenRequest: {
|
|
944
734
|
authIn: "body",
|
|
945
735
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -948,7 +738,6 @@ var providers = defineProviders({
|
|
|
948
738
|
},
|
|
949
739
|
keycloak: {
|
|
950
740
|
authorizationUrl: (config) => `${config.realmURL}/protocol/openid-connect/auth`,
|
|
951
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
952
741
|
isOIDC: true,
|
|
953
742
|
isRefreshable: true,
|
|
954
743
|
PKCEMethod: "S256",
|
|
@@ -965,6 +754,8 @@ var providers = defineProviders({
|
|
|
965
754
|
url: (config) => `${config.realmURL}/protocol/openid-connect/revoke`
|
|
966
755
|
},
|
|
967
756
|
scopeRequired: false,
|
|
757
|
+
subject: ["sub"],
|
|
758
|
+
subjectType: "string",
|
|
968
759
|
tokenRequest: {
|
|
969
760
|
authIn: "body",
|
|
970
761
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -973,18 +764,10 @@ var providers = defineProviders({
|
|
|
973
764
|
},
|
|
974
765
|
kick: {
|
|
975
766
|
authorizationUrl: "https://id.kick.com/oauth/authorize",
|
|
976
|
-
|
|
977
|
-
const subject = extractPropFromIdentity(identity, [
|
|
978
|
-
"data",
|
|
979
|
-
"user_id"
|
|
980
|
-
]);
|
|
981
|
-
if (typeof subject !== "number") {
|
|
982
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
983
|
-
}
|
|
984
|
-
return subject;
|
|
985
|
-
},
|
|
767
|
+
email: ["data", "email"],
|
|
986
768
|
isOIDC: false,
|
|
987
769
|
isRefreshable: true,
|
|
770
|
+
picture: ["data", "profile_picture"],
|
|
988
771
|
PKCEMethod: "S256",
|
|
989
772
|
profileRequest: {
|
|
990
773
|
authIn: "header",
|
|
@@ -999,6 +782,8 @@ var providers = defineProviders({
|
|
|
999
782
|
url: "https://id.kick.com/oauth/revoke"
|
|
1000
783
|
},
|
|
1001
784
|
scopeRequired: true,
|
|
785
|
+
subject: ["data", "user_id"],
|
|
786
|
+
subjectType: "number",
|
|
1002
787
|
tokenRequest: {
|
|
1003
788
|
authIn: "body",
|
|
1004
789
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1007,13 +792,6 @@ var providers = defineProviders({
|
|
|
1007
792
|
},
|
|
1008
793
|
lichess: {
|
|
1009
794
|
authorizationUrl: "https://lichess.org/oauth/authorize",
|
|
1010
|
-
extractSubjectFromIdentity(identity) {
|
|
1011
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1012
|
-
if (typeof subject !== "number") {
|
|
1013
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1014
|
-
}
|
|
1015
|
-
return subject;
|
|
1016
|
-
},
|
|
1017
795
|
isOIDC: false,
|
|
1018
796
|
isRefreshable: false,
|
|
1019
797
|
PKCEMethod: "S256",
|
|
@@ -1024,6 +802,8 @@ var providers = defineProviders({
|
|
|
1024
802
|
url: "https://lichess.org/api/account"
|
|
1025
803
|
},
|
|
1026
804
|
scopeRequired: false,
|
|
805
|
+
subject: ["id"],
|
|
806
|
+
subjectType: "string",
|
|
1027
807
|
tokenRequest: {
|
|
1028
808
|
authIn: "body",
|
|
1029
809
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1032,7 +812,6 @@ var providers = defineProviders({
|
|
|
1032
812
|
},
|
|
1033
813
|
line: {
|
|
1034
814
|
authorizationUrl: "https://access.line.me/oauth2/v2.1/authorize",
|
|
1035
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1036
815
|
isOIDC: true,
|
|
1037
816
|
isRefreshable: true,
|
|
1038
817
|
PKCEMethod: "S256",
|
|
@@ -1043,6 +822,8 @@ var providers = defineProviders({
|
|
|
1043
822
|
url: "https://api.line.me/v2/profile"
|
|
1044
823
|
},
|
|
1045
824
|
scopeRequired: true,
|
|
825
|
+
subject: ["sub"],
|
|
826
|
+
subjectType: "string",
|
|
1046
827
|
tokenRequest: {
|
|
1047
828
|
authIn: "body",
|
|
1048
829
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1051,17 +832,6 @@ var providers = defineProviders({
|
|
|
1051
832
|
},
|
|
1052
833
|
linear: {
|
|
1053
834
|
authorizationUrl: "https://linear.app/oauth/authorize",
|
|
1054
|
-
extractSubjectFromIdentity(identity) {
|
|
1055
|
-
const subject = extractPropFromIdentity(identity, [
|
|
1056
|
-
"data",
|
|
1057
|
-
"viewer",
|
|
1058
|
-
"id"
|
|
1059
|
-
]);
|
|
1060
|
-
if (typeof subject !== "string") {
|
|
1061
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1062
|
-
}
|
|
1063
|
-
return subject;
|
|
1064
|
-
},
|
|
1065
835
|
isOIDC: false,
|
|
1066
836
|
isRefreshable: false,
|
|
1067
837
|
profileRequest: {
|
|
@@ -1083,6 +853,8 @@ var providers = defineProviders({
|
|
|
1083
853
|
url: "https://api.linear.app/oauth/revoke"
|
|
1084
854
|
},
|
|
1085
855
|
scopeRequired: false,
|
|
856
|
+
subject: ["data", "viewer", "id"],
|
|
857
|
+
subjectType: "string",
|
|
1086
858
|
tokenRequest: {
|
|
1087
859
|
authIn: "body",
|
|
1088
860
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1091,7 +863,6 @@ var providers = defineProviders({
|
|
|
1091
863
|
},
|
|
1092
864
|
linkedin: {
|
|
1093
865
|
authorizationUrl: "https://www.linkedin.com/oauth/v2/authorization",
|
|
1094
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1095
866
|
isOIDC: true,
|
|
1096
867
|
isRefreshable: true,
|
|
1097
868
|
PKCEMethod: "S256",
|
|
@@ -1102,6 +873,8 @@ var providers = defineProviders({
|
|
|
1102
873
|
url: "https://api.linkedin.com/v2/me"
|
|
1103
874
|
},
|
|
1104
875
|
scopeRequired: true,
|
|
876
|
+
subject: ["sub"],
|
|
877
|
+
subjectType: "string",
|
|
1105
878
|
tokenRequest: {
|
|
1106
879
|
authIn: "body",
|
|
1107
880
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1110,15 +883,9 @@ var providers = defineProviders({
|
|
|
1110
883
|
},
|
|
1111
884
|
mastodon: {
|
|
1112
885
|
authorizationUrl: (config) => `${config.baseURL}/oauth/authorize`,
|
|
1113
|
-
extractSubjectFromIdentity(identity) {
|
|
1114
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1115
|
-
if (typeof subject !== "string") {
|
|
1116
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1117
|
-
}
|
|
1118
|
-
return subject;
|
|
1119
|
-
},
|
|
1120
886
|
isOIDC: false,
|
|
1121
887
|
isRefreshable: false,
|
|
888
|
+
picture: ["avatar"],
|
|
1122
889
|
PKCEMethod: "S256",
|
|
1123
890
|
profileRequest: {
|
|
1124
891
|
authIn: "header",
|
|
@@ -1133,6 +900,8 @@ var providers = defineProviders({
|
|
|
1133
900
|
url: (config) => `${config.baseURL}/oauth/revoke`
|
|
1134
901
|
},
|
|
1135
902
|
scopeRequired: false,
|
|
903
|
+
subject: ["id"],
|
|
904
|
+
subjectType: "string",
|
|
1136
905
|
tokenRequest: {
|
|
1137
906
|
authIn: "body",
|
|
1138
907
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1141,13 +910,6 @@ var providers = defineProviders({
|
|
|
1141
910
|
},
|
|
1142
911
|
mercadolibre: {
|
|
1143
912
|
authorizationUrl: "https://auth.mercadolibre.com/authorization",
|
|
1144
|
-
extractSubjectFromIdentity(identity) {
|
|
1145
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1146
|
-
if (typeof subject !== "number") {
|
|
1147
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1148
|
-
}
|
|
1149
|
-
return subject;
|
|
1150
|
-
},
|
|
1151
913
|
isOIDC: false,
|
|
1152
914
|
isRefreshable: true,
|
|
1153
915
|
PKCEMethod: "S256",
|
|
@@ -1158,6 +920,8 @@ var providers = defineProviders({
|
|
|
1158
920
|
url: "https://api.mercadolibre.com/users/me"
|
|
1159
921
|
},
|
|
1160
922
|
scopeRequired: false,
|
|
923
|
+
subject: ["id"],
|
|
924
|
+
subjectType: "number",
|
|
1161
925
|
tokenRequest: {
|
|
1162
926
|
authIn: "body",
|
|
1163
927
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1166,13 +930,6 @@ var providers = defineProviders({
|
|
|
1166
930
|
},
|
|
1167
931
|
mercadopago: {
|
|
1168
932
|
authorizationUrl: "https://auth.mercadopago.com/authorization",
|
|
1169
|
-
extractSubjectFromIdentity(identity) {
|
|
1170
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1171
|
-
if (typeof subject !== "number") {
|
|
1172
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1173
|
-
}
|
|
1174
|
-
return subject;
|
|
1175
|
-
},
|
|
1176
933
|
isOIDC: false,
|
|
1177
934
|
isRefreshable: true,
|
|
1178
935
|
profileRequest: {
|
|
@@ -1182,6 +939,8 @@ var providers = defineProviders({
|
|
|
1182
939
|
url: "https://api.mercadopago.com/v1/users/me"
|
|
1183
940
|
},
|
|
1184
941
|
scopeRequired: false,
|
|
942
|
+
subject: ["id"],
|
|
943
|
+
subjectType: "number",
|
|
1185
944
|
tokenRequest: {
|
|
1186
945
|
authIn: "body",
|
|
1187
946
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1190,7 +949,6 @@ var providers = defineProviders({
|
|
|
1190
949
|
},
|
|
1191
950
|
microsoftentraid: {
|
|
1192
951
|
authorizationUrl: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/oauth2/v2.0/authorize`,
|
|
1193
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1194
952
|
isOIDC: true,
|
|
1195
953
|
isRefreshable: true,
|
|
1196
954
|
PKCEMethod: "S256",
|
|
@@ -1201,6 +959,8 @@ var providers = defineProviders({
|
|
|
1201
959
|
url: (config) => `https://${config.tenantId}.b2clogin.com/${config.tenantId}/openid/userinfo`
|
|
1202
960
|
},
|
|
1203
961
|
scopeRequired: false,
|
|
962
|
+
subject: ["sub"],
|
|
963
|
+
subjectType: "string",
|
|
1204
964
|
tokenRequest: {
|
|
1205
965
|
authIn: "body",
|
|
1206
966
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1209,13 +969,6 @@ var providers = defineProviders({
|
|
|
1209
969
|
},
|
|
1210
970
|
myanimelist: {
|
|
1211
971
|
authorizationUrl: "https://myanimelist.net/v1/oauth2/authorize",
|
|
1212
|
-
extractSubjectFromIdentity(identity) {
|
|
1213
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1214
|
-
if (typeof subject !== "number") {
|
|
1215
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1216
|
-
}
|
|
1217
|
-
return subject;
|
|
1218
|
-
},
|
|
1219
972
|
isOIDC: false,
|
|
1220
973
|
isRefreshable: true,
|
|
1221
974
|
PKCEMethod: "plain",
|
|
@@ -1226,6 +979,8 @@ var providers = defineProviders({
|
|
|
1226
979
|
url: "https://api.myanimelist.net/v2/users/@me"
|
|
1227
980
|
},
|
|
1228
981
|
scopeRequired: false,
|
|
982
|
+
subject: ["id"],
|
|
983
|
+
subjectType: "number",
|
|
1229
984
|
tokenRequest: {
|
|
1230
985
|
authIn: "body",
|
|
1231
986
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1234,18 +989,11 @@ var providers = defineProviders({
|
|
|
1234
989
|
},
|
|
1235
990
|
naver: {
|
|
1236
991
|
authorizationUrl: "https://nid.naver.com/oauth2.0/authorize",
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
"response",
|
|
1240
|
-
"id"
|
|
1241
|
-
]);
|
|
1242
|
-
if (typeof subject !== "string") {
|
|
1243
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1244
|
-
}
|
|
1245
|
-
return subject;
|
|
1246
|
-
},
|
|
992
|
+
email: ["response", "email"],
|
|
993
|
+
fullName: ["response", "name"],
|
|
1247
994
|
isOIDC: false,
|
|
1248
995
|
isRefreshable: true,
|
|
996
|
+
picture: ["response", "profile_image"],
|
|
1249
997
|
profileRequest: {
|
|
1250
998
|
authIn: "header",
|
|
1251
999
|
encoding: "application/json",
|
|
@@ -1253,6 +1001,8 @@ var providers = defineProviders({
|
|
|
1253
1001
|
url: "https://openapi.naver.com/v1/nid/me"
|
|
1254
1002
|
},
|
|
1255
1003
|
scopeRequired: false,
|
|
1004
|
+
subject: ["response", "id"],
|
|
1005
|
+
subjectType: "string",
|
|
1256
1006
|
tokenRequest: {
|
|
1257
1007
|
authIn: "body",
|
|
1258
1008
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1261,15 +1011,10 @@ var providers = defineProviders({
|
|
|
1261
1011
|
},
|
|
1262
1012
|
notion: {
|
|
1263
1013
|
authorizationUrl: "https://api.notion.com/v1/oauth/authorize",
|
|
1264
|
-
|
|
1265
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1266
|
-
if (typeof subject !== "string") {
|
|
1267
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1268
|
-
}
|
|
1269
|
-
return subject;
|
|
1270
|
-
},
|
|
1014
|
+
email: ["bot", "owner", "user", "person", "email"],
|
|
1271
1015
|
isOIDC: false,
|
|
1272
1016
|
isRefreshable: false,
|
|
1017
|
+
picture: ["bot", "owner", "user", "avatar_url"],
|
|
1273
1018
|
profileRequest: {
|
|
1274
1019
|
authIn: "header",
|
|
1275
1020
|
encoding: "application/json",
|
|
@@ -1280,6 +1025,8 @@ var providers = defineProviders({
|
|
|
1280
1025
|
url: "https://api.notion.com/v1/users/me"
|
|
1281
1026
|
},
|
|
1282
1027
|
scopeRequired: false,
|
|
1028
|
+
subject: ["bot", "owner", "user", "id"],
|
|
1029
|
+
subjectType: "string",
|
|
1283
1030
|
tokenRequest: {
|
|
1284
1031
|
authIn: "header",
|
|
1285
1032
|
encoding: "application/json",
|
|
@@ -1288,7 +1035,6 @@ var providers = defineProviders({
|
|
|
1288
1035
|
},
|
|
1289
1036
|
okta: {
|
|
1290
1037
|
authorizationUrl: (config) => `https://${config.domain}/oauth2/default/v1/authorize`,
|
|
1291
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1292
1038
|
isOIDC: true,
|
|
1293
1039
|
isRefreshable: true,
|
|
1294
1040
|
PKCEMethod: "S256",
|
|
@@ -1305,6 +1051,8 @@ var providers = defineProviders({
|
|
|
1305
1051
|
url: (config) => `https://${config.domain}/oauth2/default/v1/revoke`
|
|
1306
1052
|
},
|
|
1307
1053
|
scopeRequired: true,
|
|
1054
|
+
subject: ["sub"],
|
|
1055
|
+
subjectType: "string",
|
|
1308
1056
|
tokenRequest: {
|
|
1309
1057
|
authIn: "body",
|
|
1310
1058
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1313,15 +1061,9 @@ var providers = defineProviders({
|
|
|
1313
1061
|
},
|
|
1314
1062
|
osu: {
|
|
1315
1063
|
authorizationUrl: "https://osu.ppy.sh/oauth/authorize",
|
|
1316
|
-
extractSubjectFromIdentity(identity) {
|
|
1317
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1318
|
-
if (typeof subject !== "number") {
|
|
1319
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1320
|
-
}
|
|
1321
|
-
return subject;
|
|
1322
|
-
},
|
|
1323
1064
|
isOIDC: false,
|
|
1324
1065
|
isRefreshable: true,
|
|
1066
|
+
picture: ["avatar_url"],
|
|
1325
1067
|
profileRequest: {
|
|
1326
1068
|
authIn: "header",
|
|
1327
1069
|
encoding: "application/json",
|
|
@@ -1329,6 +1071,8 @@ var providers = defineProviders({
|
|
|
1329
1071
|
url: "https://osu.ppy.sh/api/v2/me"
|
|
1330
1072
|
},
|
|
1331
1073
|
scopeRequired: false,
|
|
1074
|
+
subject: ["id"],
|
|
1075
|
+
subjectType: "number",
|
|
1332
1076
|
tokenRequest: {
|
|
1333
1077
|
authIn: "body",
|
|
1334
1078
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1337,13 +1081,6 @@ var providers = defineProviders({
|
|
|
1337
1081
|
},
|
|
1338
1082
|
patreon: {
|
|
1339
1083
|
authorizationUrl: "https://www.patreon.com/oauth2/authorize",
|
|
1340
|
-
extractSubjectFromIdentity(identity) {
|
|
1341
|
-
const subject = extractPropFromIdentity(identity, ["data", "id"]);
|
|
1342
|
-
if (typeof subject !== "string") {
|
|
1343
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1344
|
-
}
|
|
1345
|
-
return subject;
|
|
1346
|
-
},
|
|
1347
1084
|
isOIDC: false,
|
|
1348
1085
|
isRefreshable: true,
|
|
1349
1086
|
profileRequest: {
|
|
@@ -1353,6 +1090,8 @@ var providers = defineProviders({
|
|
|
1353
1090
|
url: "https://www.patreon.com/api/oauth2/v2/identity"
|
|
1354
1091
|
},
|
|
1355
1092
|
scopeRequired: false,
|
|
1093
|
+
subject: ["data", "id"],
|
|
1094
|
+
subjectType: "string",
|
|
1356
1095
|
tokenRequest: {
|
|
1357
1096
|
authIn: "body",
|
|
1358
1097
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1361,7 +1100,6 @@ var providers = defineProviders({
|
|
|
1361
1100
|
},
|
|
1362
1101
|
polar: {
|
|
1363
1102
|
authorizationUrl: "https://polar.sh/oauth2/authorize",
|
|
1364
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1365
1103
|
isOIDC: true,
|
|
1366
1104
|
isRefreshable: true,
|
|
1367
1105
|
PKCEMethod: "S256",
|
|
@@ -1378,6 +1116,8 @@ var providers = defineProviders({
|
|
|
1378
1116
|
url: "https://api.polar.sh/v1/oauth2/revoke"
|
|
1379
1117
|
},
|
|
1380
1118
|
scopeRequired: true,
|
|
1119
|
+
subject: ["sub"],
|
|
1120
|
+
subjectType: "string",
|
|
1381
1121
|
tokenRequest: {
|
|
1382
1122
|
authIn: "body",
|
|
1383
1123
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1386,13 +1126,6 @@ var providers = defineProviders({
|
|
|
1386
1126
|
},
|
|
1387
1127
|
polaraccesslink: {
|
|
1388
1128
|
authorizationUrl: "https://flow.polar.com/oauth2/authorization",
|
|
1389
|
-
extractSubjectFromIdentity(identity) {
|
|
1390
|
-
const subject = extractPropFromIdentity(identity, ["x_user_id"]);
|
|
1391
|
-
if (typeof subject !== "number") {
|
|
1392
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1393
|
-
}
|
|
1394
|
-
return subject;
|
|
1395
|
-
},
|
|
1396
1129
|
isOIDC: false,
|
|
1397
1130
|
isRefreshable: false,
|
|
1398
1131
|
PKCEMethod: "S256",
|
|
@@ -1403,6 +1136,8 @@ var providers = defineProviders({
|
|
|
1403
1136
|
url: "https://www.polaraccesslink.com/v3/users/me"
|
|
1404
1137
|
},
|
|
1405
1138
|
scopeRequired: false,
|
|
1139
|
+
subject: ["x_user_id"],
|
|
1140
|
+
subjectType: "number",
|
|
1406
1141
|
tokenRequest: {
|
|
1407
1142
|
authIn: "header",
|
|
1408
1143
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1411,13 +1146,6 @@ var providers = defineProviders({
|
|
|
1411
1146
|
},
|
|
1412
1147
|
polarteampro: {
|
|
1413
1148
|
authorizationUrl: "https://auth.polar.com/oauth/authorize",
|
|
1414
|
-
extractSubjectFromIdentity(identity) {
|
|
1415
|
-
const subject = extractPropFromIdentity(identity, ["x_user_id"]);
|
|
1416
|
-
if (typeof subject !== "number") {
|
|
1417
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1418
|
-
}
|
|
1419
|
-
return subject;
|
|
1420
|
-
},
|
|
1421
1149
|
isOIDC: false,
|
|
1422
1150
|
isRefreshable: true,
|
|
1423
1151
|
PKCEMethod: "S256",
|
|
@@ -1428,6 +1156,8 @@ var providers = defineProviders({
|
|
|
1428
1156
|
url: "https://www.polaraccesslink.com/v3/users/<USER_ID>"
|
|
1429
1157
|
},
|
|
1430
1158
|
scopeRequired: false,
|
|
1159
|
+
subject: ["x_user_id"],
|
|
1160
|
+
subjectType: "number",
|
|
1431
1161
|
tokenRequest: {
|
|
1432
1162
|
authIn: "header",
|
|
1433
1163
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1436,13 +1166,6 @@ var providers = defineProviders({
|
|
|
1436
1166
|
},
|
|
1437
1167
|
reddit: {
|
|
1438
1168
|
authorizationUrl: "https://www.reddit.com/api/v1/authorize",
|
|
1439
|
-
extractSubjectFromIdentity(identity) {
|
|
1440
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1441
|
-
if (typeof subject !== "number") {
|
|
1442
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1443
|
-
}
|
|
1444
|
-
return subject;
|
|
1445
|
-
},
|
|
1446
1169
|
isOIDC: false,
|
|
1447
1170
|
isRefreshable: true,
|
|
1448
1171
|
profileRequest: {
|
|
@@ -1460,6 +1183,8 @@ var providers = defineProviders({
|
|
|
1460
1183
|
url: "https://www.reddit.com/api/v1/revoke_token"
|
|
1461
1184
|
},
|
|
1462
1185
|
scopeRequired: true,
|
|
1186
|
+
subject: ["sub"],
|
|
1187
|
+
subjectType: "string",
|
|
1463
1188
|
tokenRequest: {
|
|
1464
1189
|
authIn: "header",
|
|
1465
1190
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1468,9 +1193,9 @@ var providers = defineProviders({
|
|
|
1468
1193
|
},
|
|
1469
1194
|
roblox: {
|
|
1470
1195
|
authorizationUrl: "https://apis.roblox.com/oauth/v1/authorize",
|
|
1471
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1472
1196
|
isOIDC: true,
|
|
1473
1197
|
isRefreshable: true,
|
|
1198
|
+
picture: ["picture"],
|
|
1474
1199
|
PKCEMethod: "S256",
|
|
1475
1200
|
profileRequest: {
|
|
1476
1201
|
authIn: "header",
|
|
@@ -1479,6 +1204,8 @@ var providers = defineProviders({
|
|
|
1479
1204
|
url: "https://apis.roblox.com/oauth/v1/userinfo"
|
|
1480
1205
|
},
|
|
1481
1206
|
scopeRequired: true,
|
|
1207
|
+
subject: ["sub"],
|
|
1208
|
+
subjectType: "string",
|
|
1482
1209
|
tokenRequest: {
|
|
1483
1210
|
authIn: "body",
|
|
1484
1211
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1487,7 +1214,6 @@ var providers = defineProviders({
|
|
|
1487
1214
|
},
|
|
1488
1215
|
salesforce: {
|
|
1489
1216
|
authorizationUrl: "https://login.salesforce.com/services/oauth2/authorize",
|
|
1490
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1491
1217
|
isOIDC: true,
|
|
1492
1218
|
isRefreshable: true,
|
|
1493
1219
|
PKCEMethod: "S256",
|
|
@@ -1503,6 +1229,8 @@ var providers = defineProviders({
|
|
|
1503
1229
|
url: "https://login.salesforce.com/services/oauth2/revoke"
|
|
1504
1230
|
},
|
|
1505
1231
|
scopeRequired: false,
|
|
1232
|
+
subject: ["sub"],
|
|
1233
|
+
subjectType: "string",
|
|
1506
1234
|
tokenRequest: {
|
|
1507
1235
|
authIn: "body",
|
|
1508
1236
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1511,13 +1239,6 @@ var providers = defineProviders({
|
|
|
1511
1239
|
},
|
|
1512
1240
|
shikimori: {
|
|
1513
1241
|
authorizationUrl: "https://shikimori.org/oauth/authorize",
|
|
1514
|
-
extractSubjectFromIdentity(identity) {
|
|
1515
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1516
|
-
if (typeof subject !== "number") {
|
|
1517
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1518
|
-
}
|
|
1519
|
-
return subject;
|
|
1520
|
-
},
|
|
1521
1242
|
isOIDC: false,
|
|
1522
1243
|
isRefreshable: true,
|
|
1523
1244
|
profileRequest: {
|
|
@@ -1527,6 +1248,8 @@ var providers = defineProviders({
|
|
|
1527
1248
|
url: "https://shikimori.one/api/users/whoami"
|
|
1528
1249
|
},
|
|
1529
1250
|
scopeRequired: false,
|
|
1251
|
+
subject: ["id"],
|
|
1252
|
+
subjectType: "number",
|
|
1530
1253
|
tokenRequest: {
|
|
1531
1254
|
authIn: "body",
|
|
1532
1255
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1535,7 +1258,6 @@ var providers = defineProviders({
|
|
|
1535
1258
|
},
|
|
1536
1259
|
slack: {
|
|
1537
1260
|
authorizationUrl: "https://slack.com/openid/connect/authorize",
|
|
1538
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1539
1261
|
isOIDC: true,
|
|
1540
1262
|
isRefreshable: true,
|
|
1541
1263
|
profileRequest: {
|
|
@@ -1551,6 +1273,8 @@ var providers = defineProviders({
|
|
|
1551
1273
|
url: "https://slack.com/api/auth.revoke"
|
|
1552
1274
|
},
|
|
1553
1275
|
scopeRequired: true,
|
|
1276
|
+
subject: ["sub"],
|
|
1277
|
+
subjectType: "string",
|
|
1554
1278
|
tokenRequest: {
|
|
1555
1279
|
authIn: "body",
|
|
1556
1280
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1559,13 +1283,6 @@ var providers = defineProviders({
|
|
|
1559
1283
|
},
|
|
1560
1284
|
spotify: {
|
|
1561
1285
|
authorizationUrl: "https://accounts.spotify.com/authorize",
|
|
1562
|
-
extractSubjectFromIdentity(identity) {
|
|
1563
|
-
const subject = extractPropFromIdentity(identity, ["id"]);
|
|
1564
|
-
if (typeof subject !== "string") {
|
|
1565
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1566
|
-
}
|
|
1567
|
-
return subject;
|
|
1568
|
-
},
|
|
1569
1286
|
isOIDC: false,
|
|
1570
1287
|
isRefreshable: true,
|
|
1571
1288
|
PKCEMethod: "S256",
|
|
@@ -1576,6 +1293,8 @@ var providers = defineProviders({
|
|
|
1576
1293
|
url: "https://api.spotify.com/v1/me"
|
|
1577
1294
|
},
|
|
1578
1295
|
scopeRequired: false,
|
|
1296
|
+
subject: ["id"],
|
|
1297
|
+
subjectType: "string",
|
|
1579
1298
|
tokenRequest: {
|
|
1580
1299
|
authIn: "body",
|
|
1581
1300
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1584,17 +1303,7 @@ var providers = defineProviders({
|
|
|
1584
1303
|
},
|
|
1585
1304
|
startgg: {
|
|
1586
1305
|
authorizationUrl: "https://start.gg/oauth/authorize",
|
|
1587
|
-
|
|
1588
|
-
const subject = extractPropFromIdentity(identity, [
|
|
1589
|
-
"data",
|
|
1590
|
-
"currentUser",
|
|
1591
|
-
"id"
|
|
1592
|
-
]);
|
|
1593
|
-
if (typeof subject !== "number") {
|
|
1594
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1595
|
-
}
|
|
1596
|
-
return subject;
|
|
1597
|
-
},
|
|
1306
|
+
email: ["data", "currentUser", "email"],
|
|
1598
1307
|
isOIDC: false,
|
|
1599
1308
|
isRefreshable: true,
|
|
1600
1309
|
profileRequest: {
|
|
@@ -1611,6 +1320,8 @@ var providers = defineProviders({
|
|
|
1611
1320
|
url: "https://api.start.gg/gql/alpha"
|
|
1612
1321
|
},
|
|
1613
1322
|
scopeRequired: false,
|
|
1323
|
+
subject: ["data", "currentUser", "id"],
|
|
1324
|
+
subjectType: "number",
|
|
1614
1325
|
tokenRequest: {
|
|
1615
1326
|
authIn: "body",
|
|
1616
1327
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1619,15 +1330,11 @@ var providers = defineProviders({
|
|
|
1619
1330
|
},
|
|
1620
1331
|
strava: {
|
|
1621
1332
|
authorizationUrl: "https://www.strava.com/oauth/authorize",
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
if (typeof subject !== "number") {
|
|
1625
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1626
|
-
}
|
|
1627
|
-
return subject;
|
|
1628
|
-
},
|
|
1333
|
+
familyName: ["lastname"],
|
|
1334
|
+
givenName: ["firstname"],
|
|
1629
1335
|
isOIDC: false,
|
|
1630
1336
|
isRefreshable: true,
|
|
1337
|
+
picture: ["profile"],
|
|
1631
1338
|
PKCEMethod: "S256",
|
|
1632
1339
|
profileRequest: {
|
|
1633
1340
|
authIn: "header",
|
|
@@ -1645,6 +1352,8 @@ var providers = defineProviders({
|
|
|
1645
1352
|
url: "https://www.strava.com/oauth/deauthorize"
|
|
1646
1353
|
},
|
|
1647
1354
|
scopeRequired: false,
|
|
1355
|
+
subject: ["id"],
|
|
1356
|
+
subjectType: "number",
|
|
1648
1357
|
tokenRequest: {
|
|
1649
1358
|
authIn: "body",
|
|
1650
1359
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1653,13 +1362,6 @@ var providers = defineProviders({
|
|
|
1653
1362
|
},
|
|
1654
1363
|
synology: {
|
|
1655
1364
|
authorizationUrl: (config) => `${config.baseURL}/webman/sso/SSOOauth.cgi?client_id=${config.clientId}&response_type=code&redirect_uri=${config.redirectUri}`,
|
|
1656
|
-
extractSubjectFromIdentity(identity) {
|
|
1657
|
-
const subject = extractPropFromIdentity(identity, ["data", "id"]);
|
|
1658
|
-
if (typeof subject !== "number") {
|
|
1659
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1660
|
-
}
|
|
1661
|
-
return subject;
|
|
1662
|
-
},
|
|
1663
1365
|
isOIDC: false,
|
|
1664
1366
|
isRefreshable: false,
|
|
1665
1367
|
profileRequest: {
|
|
@@ -1669,6 +1371,8 @@ var providers = defineProviders({
|
|
|
1669
1371
|
url: (config) => `${config.baseURL}/webman/sso/SSOUserInfo.cgi?client_id=${config.clientId}&access_token=${config.accessToken}`
|
|
1670
1372
|
},
|
|
1671
1373
|
scopeRequired: false,
|
|
1374
|
+
subject: ["data", "id"],
|
|
1375
|
+
subjectType: "number",
|
|
1672
1376
|
tokenRequest: {
|
|
1673
1377
|
authIn: "body",
|
|
1674
1378
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1680,16 +1384,6 @@ var providers = defineProviders({
|
|
|
1680
1384
|
createAuthorizationURLSearchParams: (config) => ({
|
|
1681
1385
|
client_key: config.clientId
|
|
1682
1386
|
}),
|
|
1683
|
-
extractSubjectFromIdentity(identity) {
|
|
1684
|
-
const subject = extractPropFromIdentity(identity, [
|
|
1685
|
-
"data",
|
|
1686
|
-
"open_id"
|
|
1687
|
-
]);
|
|
1688
|
-
if (typeof subject !== "number") {
|
|
1689
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1690
|
-
}
|
|
1691
|
-
return subject;
|
|
1692
|
-
},
|
|
1693
1387
|
isOIDC: false,
|
|
1694
1388
|
isRefreshable: true,
|
|
1695
1389
|
PKCEMethod: "S256",
|
|
@@ -1706,6 +1400,8 @@ var providers = defineProviders({
|
|
|
1706
1400
|
url: "https://open.tiktokapis.com/v2/oauth/revoke/"
|
|
1707
1401
|
},
|
|
1708
1402
|
scopeRequired: false,
|
|
1403
|
+
subject: ["data", "open_id"],
|
|
1404
|
+
subjectType: "string",
|
|
1709
1405
|
tokenRequest: {
|
|
1710
1406
|
authIn: "body",
|
|
1711
1407
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1714,13 +1410,6 @@ var providers = defineProviders({
|
|
|
1714
1410
|
},
|
|
1715
1411
|
tiltify: {
|
|
1716
1412
|
authorizationUrl: "https://v5api.tiltify.com/oauth/authorize",
|
|
1717
|
-
extractSubjectFromIdentity(identity) {
|
|
1718
|
-
const subject = extractPropFromIdentity(identity, ["data", "id"]);
|
|
1719
|
-
if (typeof subject !== "string") {
|
|
1720
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1721
|
-
}
|
|
1722
|
-
return subject;
|
|
1723
|
-
},
|
|
1724
1413
|
isOIDC: false,
|
|
1725
1414
|
isRefreshable: true,
|
|
1726
1415
|
profileRequest: {
|
|
@@ -1730,6 +1419,8 @@ var providers = defineProviders({
|
|
|
1730
1419
|
url: "https://v5api.tiltify.com/api/public/current-user"
|
|
1731
1420
|
},
|
|
1732
1421
|
scopeRequired: false,
|
|
1422
|
+
subject: ["data", "id"],
|
|
1423
|
+
subjectType: "string",
|
|
1733
1424
|
tokenRequest: {
|
|
1734
1425
|
authIn: "body",
|
|
1735
1426
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1738,17 +1429,6 @@ var providers = defineProviders({
|
|
|
1738
1429
|
},
|
|
1739
1430
|
tumblr: {
|
|
1740
1431
|
authorizationUrl: "https://www.tumblr.com/oauth2/authorize",
|
|
1741
|
-
extractSubjectFromIdentity(identity) {
|
|
1742
|
-
const subject = extractPropFromIdentity(identity, [
|
|
1743
|
-
"response",
|
|
1744
|
-
"user",
|
|
1745
|
-
"name"
|
|
1746
|
-
]);
|
|
1747
|
-
if (typeof subject !== "string") {
|
|
1748
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
1749
|
-
}
|
|
1750
|
-
return subject;
|
|
1751
|
-
},
|
|
1752
1432
|
isOIDC: false,
|
|
1753
1433
|
isRefreshable: true,
|
|
1754
1434
|
profileRequest: {
|
|
@@ -1758,6 +1438,8 @@ var providers = defineProviders({
|
|
|
1758
1438
|
url: "https://api.tumblr.com/v2/user/info"
|
|
1759
1439
|
},
|
|
1760
1440
|
scopeRequired: false,
|
|
1441
|
+
subject: ["response", "user", "name"],
|
|
1442
|
+
subjectType: "string",
|
|
1761
1443
|
tokenRequest: {
|
|
1762
1444
|
authIn: "body",
|
|
1763
1445
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1766,7 +1448,6 @@ var providers = defineProviders({
|
|
|
1766
1448
|
},
|
|
1767
1449
|
twitch: {
|
|
1768
1450
|
authorizationUrl: "https://id.twitch.tv/oauth2/authorize",
|
|
1769
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1770
1451
|
isOIDC: true,
|
|
1771
1452
|
isRefreshable: true,
|
|
1772
1453
|
profileRequest: {
|
|
@@ -1788,6 +1469,8 @@ var providers = defineProviders({
|
|
|
1788
1469
|
url: "https://id.twitch.tv/oauth2/revoke"
|
|
1789
1470
|
},
|
|
1790
1471
|
scopeRequired: false,
|
|
1472
|
+
subject: ["sub"],
|
|
1473
|
+
subjectType: "string",
|
|
1791
1474
|
tokenRequest: {
|
|
1792
1475
|
authIn: "body",
|
|
1793
1476
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1796,13 +1479,6 @@ var providers = defineProviders({
|
|
|
1796
1479
|
},
|
|
1797
1480
|
twitter: {
|
|
1798
1481
|
authorizationUrl: "https://twitter.com/i/oauth2/authorize",
|
|
1799
|
-
extractSubjectFromIdentity(identity) {
|
|
1800
|
-
const subject = extractPropFromIdentity(identity, ["data", "id"]);
|
|
1801
|
-
if (typeof subject !== "number") {
|
|
1802
|
-
throw new Error(`Invalid identity data shape: expected number got ${typeof subject}`);
|
|
1803
|
-
}
|
|
1804
|
-
return subject;
|
|
1805
|
-
},
|
|
1806
1482
|
isOIDC: false,
|
|
1807
1483
|
isRefreshable: true,
|
|
1808
1484
|
PKCEMethod: "S256",
|
|
@@ -1818,6 +1494,8 @@ var providers = defineProviders({
|
|
|
1818
1494
|
url: "https://api.twitter.com/2/oauth2/revoke"
|
|
1819
1495
|
},
|
|
1820
1496
|
scopeRequired: false,
|
|
1497
|
+
subject: ["data", "id"],
|
|
1498
|
+
subjectType: "number",
|
|
1821
1499
|
tokenRequest: {
|
|
1822
1500
|
authIn: "body",
|
|
1823
1501
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1826,17 +1504,6 @@ var providers = defineProviders({
|
|
|
1826
1504
|
},
|
|
1827
1505
|
vk: {
|
|
1828
1506
|
authorizationUrl: "https://oauth.vk.com/authorize",
|
|
1829
|
-
extractSubjectFromIdentity(identity) {
|
|
1830
|
-
const subject = extractPropFromIdentity(identity, [
|
|
1831
|
-
"response",
|
|
1832
|
-
"0",
|
|
1833
|
-
"id"
|
|
1834
|
-
]);
|
|
1835
|
-
if (typeof subject !== "number") {
|
|
1836
|
-
throw new Error(`Invalid identity data shape: expected number, got ${typeof subject}`);
|
|
1837
|
-
}
|
|
1838
|
-
return subject;
|
|
1839
|
-
},
|
|
1840
1507
|
isOIDC: false,
|
|
1841
1508
|
isRefreshable: false,
|
|
1842
1509
|
profileRequest: {
|
|
@@ -1846,6 +1513,8 @@ var providers = defineProviders({
|
|
|
1846
1513
|
url: "https://api.vk.com/method/users.get"
|
|
1847
1514
|
},
|
|
1848
1515
|
scopeRequired: false,
|
|
1516
|
+
subject: ["response", "0", "id"],
|
|
1517
|
+
subjectType: "number",
|
|
1849
1518
|
tokenRequest: {
|
|
1850
1519
|
authIn: "body",
|
|
1851
1520
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1854,13 +1523,6 @@ var providers = defineProviders({
|
|
|
1854
1523
|
},
|
|
1855
1524
|
withings: {
|
|
1856
1525
|
authorizationUrl: "https://account.withings.com/oauth2_user/authorize2",
|
|
1857
|
-
extractSubjectFromIdentity(identity) {
|
|
1858
|
-
const subject = extractPropFromIdentity(identity, ["userid"]);
|
|
1859
|
-
if (typeof subject !== "string") {
|
|
1860
|
-
throw new Error(`Invalid identity data shape: expected string, got ${typeof subject}`);
|
|
1861
|
-
}
|
|
1862
|
-
return subject;
|
|
1863
|
-
},
|
|
1864
1526
|
isOIDC: false,
|
|
1865
1527
|
isRefreshable: true,
|
|
1866
1528
|
profileRequest: {
|
|
@@ -1903,6 +1565,8 @@ var providers = defineProviders({
|
|
|
1903
1565
|
url: "https://wbsapi.withings.net/v2/oauth2"
|
|
1904
1566
|
},
|
|
1905
1567
|
scopeRequired: true,
|
|
1568
|
+
subject: ["userid"],
|
|
1569
|
+
subjectType: "string",
|
|
1906
1570
|
tokenRequest: {
|
|
1907
1571
|
authIn: "body",
|
|
1908
1572
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1914,13 +1578,16 @@ var providers = defineProviders({
|
|
|
1914
1578
|
},
|
|
1915
1579
|
workos: {
|
|
1916
1580
|
authorizationUrl: (config) => `https://${config.domain}/oauth2/authorize`,
|
|
1917
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1918
1581
|
createAuthorizationURLSearchParams: () => {
|
|
1919
1582
|
const nonce = crypto.randomUUID();
|
|
1920
1583
|
return {
|
|
1921
1584
|
nonce
|
|
1922
1585
|
};
|
|
1923
1586
|
},
|
|
1587
|
+
email: ["email"],
|
|
1588
|
+
familyName: ["family_name"],
|
|
1589
|
+
fullName: ["name"],
|
|
1590
|
+
givenName: ["given_name"],
|
|
1924
1591
|
isOIDC: true,
|
|
1925
1592
|
isRefreshable: true,
|
|
1926
1593
|
PKCEMethod: "S256",
|
|
@@ -1931,6 +1598,8 @@ var providers = defineProviders({
|
|
|
1931
1598
|
url: (config) => `https://${config.domain}/oauth2/userinfo`
|
|
1932
1599
|
},
|
|
1933
1600
|
scopeRequired: false,
|
|
1601
|
+
subject: ["sub"],
|
|
1602
|
+
subjectType: "string",
|
|
1934
1603
|
tokenRequest: {
|
|
1935
1604
|
authIn: "body",
|
|
1936
1605
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1939,7 +1608,6 @@ var providers = defineProviders({
|
|
|
1939
1608
|
},
|
|
1940
1609
|
yahoo: {
|
|
1941
1610
|
authorizationUrl: "https://api.login.yahoo.com/oauth2/request_auth",
|
|
1942
|
-
extractSubjectFromIdentity: extractSubFromOIDCIdentity,
|
|
1943
1611
|
isOIDC: true,
|
|
1944
1612
|
isRefreshable: true,
|
|
1945
1613
|
PKCEMethod: "S256",
|
|
@@ -1955,6 +1623,8 @@ var providers = defineProviders({
|
|
|
1955
1623
|
url: "https://api.login.yahoo.com/oauth2/revoke"
|
|
1956
1624
|
},
|
|
1957
1625
|
scopeRequired: false,
|
|
1626
|
+
subject: ["sub"],
|
|
1627
|
+
subjectType: "string",
|
|
1958
1628
|
tokenRequest: {
|
|
1959
1629
|
authIn: "body",
|
|
1960
1630
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1967,13 +1637,10 @@ var providers = defineProviders({
|
|
|
1967
1637
|
device_id: crypto.randomUUID(),
|
|
1968
1638
|
device_name: `${navigator.platform ?? "Unknown"} \u2014 ${(navigator.userAgent.split(")")[0] || "").split("(").pop() || "Unknown"}`
|
|
1969
1639
|
},
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
}
|
|
1975
|
-
return subject;
|
|
1976
|
-
},
|
|
1640
|
+
email: ["default_email"],
|
|
1641
|
+
familyName: ["last_name"],
|
|
1642
|
+
fullName: ["real_name"],
|
|
1643
|
+
givenName: ["first_name"],
|
|
1977
1644
|
isOIDC: false,
|
|
1978
1645
|
isRefreshable: true,
|
|
1979
1646
|
PKCEMethod: "S256",
|
|
@@ -1990,6 +1657,8 @@ var providers = defineProviders({
|
|
|
1990
1657
|
url: "https://oauth.yandex.com/revoke_token"
|
|
1991
1658
|
},
|
|
1992
1659
|
scopeRequired: false,
|
|
1660
|
+
subject: ["id"],
|
|
1661
|
+
subjectType: "string",
|
|
1993
1662
|
tokenRequest: {
|
|
1994
1663
|
authIn: "body",
|
|
1995
1664
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -1998,15 +1667,12 @@ var providers = defineProviders({
|
|
|
1998
1667
|
},
|
|
1999
1668
|
zoom: {
|
|
2000
1669
|
authorizationUrl: "https://zoom.us/oauth/authorize",
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
throw new Error(`Invalid identity data shape: expected string got ${typeof subject}`);
|
|
2005
|
-
}
|
|
2006
|
-
return subject;
|
|
2007
|
-
},
|
|
1670
|
+
email: ["email"],
|
|
1671
|
+
familyName: ["last_name"],
|
|
1672
|
+
givenName: ["first_name"],
|
|
2008
1673
|
isOIDC: false,
|
|
2009
1674
|
isRefreshable: true,
|
|
1675
|
+
picture: ["pic_url"],
|
|
2010
1676
|
PKCEMethod: "S256",
|
|
2011
1677
|
profileRequest: {
|
|
2012
1678
|
authIn: "header",
|
|
@@ -2024,6 +1690,8 @@ var providers = defineProviders({
|
|
|
2024
1690
|
url: "https://zoom.us/oauth/revoke"
|
|
2025
1691
|
},
|
|
2026
1692
|
scopeRequired: false,
|
|
1693
|
+
subject: ["id"],
|
|
1694
|
+
subjectType: "string",
|
|
2027
1695
|
tokenRequest: {
|
|
2028
1696
|
authIn: "body",
|
|
2029
1697
|
encoding: "application/x-www-form-urlencoded",
|
|
@@ -2031,6 +1699,171 @@ var providers = defineProviders({
|
|
|
2031
1699
|
}
|
|
2032
1700
|
}
|
|
2033
1701
|
});
|
|
1702
|
+
var isValidProviderOption = (option) => Object.hasOwn(providers, option);
|
|
1703
|
+
var isRefreshableProviderOption = (option) => {
|
|
1704
|
+
if (!isValidProviderOption(option))
|
|
1705
|
+
return false;
|
|
1706
|
+
const provider = providers[option];
|
|
1707
|
+
return provider.isRefreshable;
|
|
1708
|
+
};
|
|
1709
|
+
var isRevocableProviderOption = (option) => {
|
|
1710
|
+
if (!isValidProviderOption(option))
|
|
1711
|
+
return false;
|
|
1712
|
+
const provider = providers[option];
|
|
1713
|
+
return provider.revocationRequest !== undefined;
|
|
1714
|
+
};
|
|
1715
|
+
var isPKCEProviderOption = (option) => {
|
|
1716
|
+
if (!isValidProviderOption(option))
|
|
1717
|
+
return false;
|
|
1718
|
+
const provider = providers[option];
|
|
1719
|
+
return provider.PKCEMethod !== undefined;
|
|
1720
|
+
};
|
|
1721
|
+
var isOIDCProviderOption = (option) => {
|
|
1722
|
+
if (!isValidProviderOption(option))
|
|
1723
|
+
return false;
|
|
1724
|
+
const provider = providers[option];
|
|
1725
|
+
return provider.isOIDC;
|
|
1726
|
+
};
|
|
1727
|
+
var isScopeRequiredProviderOption = (option) => {
|
|
1728
|
+
if (!isValidProviderOption(option))
|
|
1729
|
+
return false;
|
|
1730
|
+
const provider = providers[option];
|
|
1731
|
+
return provider.scopeRequired;
|
|
1732
|
+
};
|
|
1733
|
+
var isRefreshableOAuth2Client = (providerName, client) => isRefreshableProviderOption(providerName);
|
|
1734
|
+
var isRevocableOAuth2Client = (providerName, client) => isRevocableProviderOption(providerName);
|
|
1735
|
+
var hasClientSecret = (credentials) => {
|
|
1736
|
+
if (typeof credentials !== "object" || credentials === null)
|
|
1737
|
+
return false;
|
|
1738
|
+
const secret = Reflect.get(credentials, "clientSecret");
|
|
1739
|
+
return typeof secret === "string";
|
|
1740
|
+
};
|
|
1741
|
+
var createOAuth2FetchError = async (response) => {
|
|
1742
|
+
const clone = response.clone();
|
|
1743
|
+
const prefix = `HTTP ${response.status} ${response.statusText} for ${response.url}`;
|
|
1744
|
+
const payload = await response.json().catch(() => null);
|
|
1745
|
+
if (payload && typeof payload === "object" && Object.keys(payload).length) {
|
|
1746
|
+
return new Error(`${prefix}
|
|
1747
|
+
${JSON.stringify(payload)}`);
|
|
1748
|
+
}
|
|
1749
|
+
const text = await clone.text().catch(() => "");
|
|
1750
|
+
if (text) {
|
|
1751
|
+
return new Error(`${prefix}
|
|
1752
|
+
${text}`);
|
|
1753
|
+
}
|
|
1754
|
+
return new Error(prefix);
|
|
1755
|
+
};
|
|
1756
|
+
var encodeBase64 = (input) => {
|
|
1757
|
+
let raw;
|
|
1758
|
+
if (typeof input === "string") {
|
|
1759
|
+
raw = input;
|
|
1760
|
+
} else {
|
|
1761
|
+
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
1762
|
+
raw = bytes.reduce((acc, byte) => acc + String.fromCharCode(byte), "");
|
|
1763
|
+
}
|
|
1764
|
+
return btoa(raw);
|
|
1765
|
+
};
|
|
1766
|
+
var decodeBase64 = (input, toUint8Array = false) => {
|
|
1767
|
+
const b64 = input.replace(/-/g, "+").replace(/_/g, "/") + "==".slice(0, (BASE64_BLOCK_SIZE - input.length % BASE64_BLOCK_SIZE) % BASE64_BLOCK_SIZE);
|
|
1768
|
+
const raw = atob(b64);
|
|
1769
|
+
if (!toUint8Array) {
|
|
1770
|
+
return raw;
|
|
1771
|
+
}
|
|
1772
|
+
const bytes = new Uint8Array(raw.length);
|
|
1773
|
+
for (let i = 0;i < raw.length; i++) {
|
|
1774
|
+
bytes[i] = raw.charCodeAt(i);
|
|
1775
|
+
}
|
|
1776
|
+
return bytes;
|
|
1777
|
+
};
|
|
1778
|
+
var hmacSha256 = async (message, secret) => {
|
|
1779
|
+
const encoder = new TextEncoder;
|
|
1780
|
+
const key = await crypto.subtle.importKey("raw", encoder.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
|
|
1781
|
+
const sigBuffer = await crypto.subtle.sign("HMAC", key, encoder.encode(message));
|
|
1782
|
+
return Array.from(new Uint8Array(sigBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1783
|
+
};
|
|
1784
|
+
var decodeJWT = (tokenString) => {
|
|
1785
|
+
const [headerSegment, payloadSegment, signatureSegment] = tokenString.split(".");
|
|
1786
|
+
if (!headerSegment || !payloadSegment || !signatureSegment) {
|
|
1787
|
+
throw new Error("Invalid JWT format");
|
|
1788
|
+
}
|
|
1789
|
+
const decodedPayload = decodeBase64(payloadSegment);
|
|
1790
|
+
if (typeof decodedPayload !== "string") {
|
|
1791
|
+
throw new Error("Expected JWT payload to be a UTF-8 string");
|
|
1792
|
+
}
|
|
1793
|
+
return JSON.parse(decodedPayload);
|
|
1794
|
+
};
|
|
1795
|
+
var getWithingsProps = async (config) => {
|
|
1796
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
1797
|
+
const signature = `getnonce,${config.clientId},${timestamp}`;
|
|
1798
|
+
const hashedSignature = await hmacSha256(signature, config.clientSecret);
|
|
1799
|
+
const nonceUrl = new URL("https://wbsapi.withings.net/v2/signature");
|
|
1800
|
+
nonceUrl.searchParams.set("action", "getnonce");
|
|
1801
|
+
nonceUrl.searchParams.set("client_id", config.clientId);
|
|
1802
|
+
nonceUrl.searchParams.set("timestamp", timestamp.toString());
|
|
1803
|
+
nonceUrl.searchParams.set("signature", hashedSignature);
|
|
1804
|
+
const nonceResponse = await fetch(nonceUrl.toString(), {
|
|
1805
|
+
method: "POST"
|
|
1806
|
+
});
|
|
1807
|
+
const nonceData = await nonceResponse.json();
|
|
1808
|
+
if (nonceData.status === 0) {
|
|
1809
|
+
return {
|
|
1810
|
+
hashedSignature,
|
|
1811
|
+
nonce: nonceData.body.nonce
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
return;
|
|
1815
|
+
};
|
|
1816
|
+
var createOAuth2Request = ({
|
|
1817
|
+
url,
|
|
1818
|
+
body,
|
|
1819
|
+
authIn,
|
|
1820
|
+
headers,
|
|
1821
|
+
encoding,
|
|
1822
|
+
clientId,
|
|
1823
|
+
clientSecret
|
|
1824
|
+
}) => {
|
|
1825
|
+
const oauthHeaders = new Headers(headers);
|
|
1826
|
+
oauthHeaders.set("Accept", "application/json");
|
|
1827
|
+
oauthHeaders.set("User-Agent", "citra");
|
|
1828
|
+
if (authIn === "header") {
|
|
1829
|
+
if (!clientSecret) {
|
|
1830
|
+
throw new Error("clientSecret required for header auth");
|
|
1831
|
+
}
|
|
1832
|
+
oauthHeaders.set("Authorization", `Basic ${encodeBase64(`${clientId}:${clientSecret}`)}`);
|
|
1833
|
+
}
|
|
1834
|
+
if (encoding === "application/json") {
|
|
1835
|
+
oauthHeaders.set("Content-Type", "application/json");
|
|
1836
|
+
return new Request(url, {
|
|
1837
|
+
body: JSON.stringify(body),
|
|
1838
|
+
headers: oauthHeaders,
|
|
1839
|
+
method: "POST"
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
oauthHeaders.set("Content-Type", "application/x-www-form-urlencoded");
|
|
1843
|
+
const entries = body instanceof URLSearchParams ? Array.from(body.entries()) : Object.entries(body).filter((entry) => typeof entry[1] === "string");
|
|
1844
|
+
const params = new URLSearchParams(entries);
|
|
1845
|
+
if (authIn === "body") {
|
|
1846
|
+
params.set("client_id", clientId);
|
|
1847
|
+
clientSecret && params.set("client_secret", clientSecret);
|
|
1848
|
+
}
|
|
1849
|
+
return new Request(url, {
|
|
1850
|
+
body: params.toString(),
|
|
1851
|
+
headers: oauthHeaders,
|
|
1852
|
+
method: "POST"
|
|
1853
|
+
});
|
|
1854
|
+
};
|
|
1855
|
+
var createS256CodeChallenge = async (codeVerifier) => {
|
|
1856
|
+
const data = new TextEncoder().encode(codeVerifier);
|
|
1857
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
1858
|
+
return base64Url(hashBuffer);
|
|
1859
|
+
};
|
|
1860
|
+
var createRandomBase64UrlGenerator = (length) => () => {
|
|
1861
|
+
const buffer = crypto.getRandomValues(new Uint8Array(length));
|
|
1862
|
+
return base64Url(buffer);
|
|
1863
|
+
};
|
|
1864
|
+
var generateCodeVerifier = createRandomBase64UrlGenerator(NUM_GENERATOR_BYTES);
|
|
1865
|
+
var generateState = createRandomBase64UrlGenerator(NUM_GENERATOR_BYTES);
|
|
1866
|
+
var base64Url = (input) => encodeBase64(input).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2034
1867
|
var providerOptions = Object.keys(providers).filter(isValidProviderOption);
|
|
2035
1868
|
var refreshableProviderOptions = Object.keys(providers).filter(isRefreshableProviderOption);
|
|
2036
1869
|
var oidcProviderOptions = Object.keys(providers).filter(isOIDCProviderOption);
|
|
@@ -2790,5 +2623,5 @@ export {
|
|
|
2790
2623
|
absoluteAuth
|
|
2791
2624
|
};
|
|
2792
2625
|
|
|
2793
|
-
//# debugId=
|
|
2626
|
+
//# debugId=3953AEE7D69FE0FC64756E2164756E21
|
|
2794
2627
|
//# sourceMappingURL=index.js.map
|