@auth/qwik 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.qwik.js +17 -24
- package/package.json +2 -2
package/index.qwik.js
CHANGED
|
@@ -45,6 +45,8 @@ function parseString(setCookieValue, options) {
|
|
|
45
45
|
cookie.httpOnly = true;
|
|
46
46
|
} else if (key === "samesite") {
|
|
47
47
|
cookie.sameSite = value2;
|
|
48
|
+
} else if (key === "partitioned") {
|
|
49
|
+
cookie.partitioned = true;
|
|
48
50
|
} else {
|
|
49
51
|
cookie[key] = value2;
|
|
50
52
|
}
|
|
@@ -306,8 +308,7 @@ function QwikAuthQrl(authOptions) {
|
|
|
306
308
|
const baseSignInUrl = `/auth/${isCredentials ? "callback" : "signin"}${providerId ? `/${providerId}` : ""}`;
|
|
307
309
|
const signInUrl = `${baseSignInUrl}?${new URLSearchParams(authorizationParams)}`;
|
|
308
310
|
const data = await authAction(body, req, signInUrl, authOpts);
|
|
309
|
-
if (data.url)
|
|
310
|
-
throw req.redirect(301, data.url);
|
|
311
|
+
if (data.url) throw req.redirect(301, data.url);
|
|
311
312
|
}, "QwikAuthQrl_useSignIn_globalAction_xjVnyrcqS90", [
|
|
312
313
|
authOptions
|
|
313
314
|
]), zodQrl(/* @__PURE__ */ inlinedQrl({
|
|
@@ -384,11 +385,9 @@ async function authAction(body, req, path, authOptions) {
|
|
|
384
385
|
res.headers.forEach((value, key) => {
|
|
385
386
|
if (key === "set-cookie")
|
|
386
387
|
cookies.push(value);
|
|
387
|
-
else if (!req.headers.has(key))
|
|
388
|
-
req.headers.set(key, value);
|
|
388
|
+
else if (!req.headers.has(key)) req.headers.set(key, value);
|
|
389
389
|
});
|
|
390
|
-
if (cookies.length > 0)
|
|
391
|
-
req.headers.set("set-cookie", cookies.join(", "));
|
|
390
|
+
if (cookies.length > 0) req.headers.set("set-cookie", cookies.join(", "));
|
|
392
391
|
fixCookies(req);
|
|
393
392
|
try {
|
|
394
393
|
return await res.json();
|
|
@@ -421,16 +420,14 @@ async function getSessionData(req, options) {
|
|
|
421
420
|
const { status = 200 } = response;
|
|
422
421
|
const data = await response.json();
|
|
423
422
|
const cookie = response.headers.get("set-cookie");
|
|
424
|
-
if (!data || !Object.keys(data).length)
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
cookie
|
|
433
|
-
};
|
|
423
|
+
if (!data || !Object.keys(data).length) return {
|
|
424
|
+
data: null,
|
|
425
|
+
cookie
|
|
426
|
+
};
|
|
427
|
+
if (status === 200) return {
|
|
428
|
+
data,
|
|
429
|
+
cookie
|
|
430
|
+
};
|
|
434
431
|
throw new Error(data.message);
|
|
435
432
|
}
|
|
436
433
|
const setEnvDefaults = (env, config) => {
|
|
@@ -438,16 +435,14 @@ const setEnvDefaults = (env, config) => {
|
|
|
438
435
|
if (!config.secret?.length) {
|
|
439
436
|
config.secret = [];
|
|
440
437
|
const secret = env.get("AUTH_SECRET");
|
|
441
|
-
if (secret)
|
|
442
|
-
config.secret.push(secret);
|
|
438
|
+
if (secret) config.secret.push(secret);
|
|
443
439
|
for (const i of [
|
|
444
440
|
1,
|
|
445
441
|
2,
|
|
446
442
|
3
|
|
447
443
|
]) {
|
|
448
444
|
const secret2 = env.get(`AUTH_SECRET_${i}`);
|
|
449
|
-
if (secret2)
|
|
450
|
-
config.secret.unshift(secret2);
|
|
445
|
+
if (secret2) config.secret.unshift(secret2);
|
|
451
446
|
}
|
|
452
447
|
}
|
|
453
448
|
config.redirectProxyUrl ?? (config.redirectProxyUrl = env.get("AUTH_REDIRECT_PROXY_URL"));
|
|
@@ -459,10 +454,8 @@ const setEnvDefaults = (env, config) => {
|
|
|
459
454
|
if (finalProvider.type === "oauth" || finalProvider.type === "oidc") {
|
|
460
455
|
finalProvider.clientId ?? (finalProvider.clientId = env.get(`AUTH_${ID}_ID`));
|
|
461
456
|
finalProvider.clientSecret ?? (finalProvider.clientSecret = env.get(`AUTH_${ID}_SECRET`));
|
|
462
|
-
if (finalProvider.type === "oidc")
|
|
463
|
-
|
|
464
|
-
} else if (finalProvider.type === "email")
|
|
465
|
-
finalProvider.apiKey ?? (finalProvider.apiKey = env.get(`AUTH_${ID}_KEY`));
|
|
457
|
+
if (finalProvider.type === "oidc") finalProvider.issuer ?? (finalProvider.issuer = env.get(`AUTH_${ID}_ISSUER`));
|
|
458
|
+
} else if (finalProvider.type === "email") finalProvider.apiKey ?? (finalProvider.apiKey = env.get(`AUTH_${ID}_KEY`));
|
|
466
459
|
return finalProvider;
|
|
467
460
|
});
|
|
468
461
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth/qwik",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Authentication for Qwik.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "gioboa <giorgiob.boa@gmail.com>",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"set-cookie-parser": "^2.6.0",
|
|
52
|
-
"@auth/core": "0.37.
|
|
52
|
+
"@auth/core": "0.37.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@builder.io/qwik": "1.7.3",
|