next-auth
Advanced tools
Comparing version 0.0.0-pr.6132.47cee00f to 0.0.0-pr.6777.faa4ea2a
@@ -110,3 +110,3 @@ "use strict"; | ||
session = useJwtSession ? {} : await createSession({ | ||
sessionToken: generateSessionToken(), | ||
sessionToken: await generateSessionToken(), | ||
userId: user.id, | ||
@@ -140,3 +140,3 @@ expires: (0, _utils.fromDate)(options.session.maxAge) | ||
session = useJwtSession ? {} : await createSession({ | ||
sessionToken: generateSessionToken(), | ||
sessionToken: await generateSessionToken(), | ||
userId: userByAccount.id, | ||
@@ -203,3 +203,3 @@ expires: (0, _utils.fromDate)(options.session.maxAge) | ||
session = useJwtSession ? {} : await createSession({ | ||
sessionToken: generateSessionToken(), | ||
sessionToken: await generateSessionToken(), | ||
userId: user.id, | ||
@@ -206,0 +206,0 @@ expires: (0, _utils.fromDate)(options.session.maxAge) |
@@ -58,2 +58,5 @@ "use strict"; | ||
})}`; | ||
_clientLegacy.oAuth1TokenStore.set(tokens.oauth_token, tokens.oauth_token_secret); | ||
logger.debug("GET_AUTHORIZATION_URL", { | ||
@@ -60,0 +63,0 @@ url, |
@@ -58,3 +58,3 @@ "use strict"; | ||
} = query !== null && query !== void 0 ? query : {}; | ||
const tokens = await client.getOAuthAccessToken(oauth_token, null, oauth_verifier); | ||
const tokens = await client.getOAuthAccessToken(oauth_token, _clientLegacy.oAuth1TokenStore.get(oauth_token), oauth_verifier); | ||
let profile = await client.get(provider.profileUrl, tokens.oauth_token, tokens.oauth_token_secret); | ||
@@ -81,2 +81,4 @@ | ||
if (query !== null && query !== void 0 && query.oauth_token) _clientLegacy.oAuth1TokenStore.delete(query.oauth_token); | ||
try { | ||
@@ -83,0 +85,0 @@ var _provider$token, _provider$token2, _provider$userinfo; |
@@ -7,1 +7,2 @@ import { OAuth } from "oauth"; | ||
export declare function oAuth1Client(options: InternalOptions<"oauth">): OAuth; | ||
export declare const oAuth1TokenStore: Map<any, any>; |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.oAuth1Client = oAuth1Client; | ||
exports.oAuth1TokenStore = void 0; | ||
@@ -66,2 +67,5 @@ var _oauth = require("oauth"); | ||
return oauth1Client; | ||
} | ||
} | ||
const oAuth1TokenStore = new Map(); | ||
exports.oAuth1TokenStore = oAuth1TokenStore; |
@@ -69,9 +69,9 @@ "use strict"; | ||
} | ||
}), (theme === null || theme === void 0 ? void 0 : theme.logo) && (0, _preact.h)("img", { | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, (theme === null || theme === void 0 ? void 0 : theme.logo) && (0, _preact.h)("img", { | ||
src: theme.logo, | ||
alt: "Logo", | ||
className: "logo" | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, (0, _preact.h)("h1", null, heading), (0, _preact.h)("div", { | ||
}), (0, _preact.h)("h1", null, heading), (0, _preact.h)("div", { | ||
className: "message" | ||
@@ -78,0 +78,0 @@ }, message), signin)) |
@@ -35,2 +35,6 @@ "use strict"; | ||
if (typeof document !== "undefined" && theme.buttonText) { | ||
document.documentElement.style.setProperty("--button-text-color", theme.buttonText); | ||
} | ||
if (typeof document !== "undefined" && theme.brandColor) { | ||
@@ -54,2 +58,3 @@ document.documentElement.style.setProperty("--brand-color", theme.brandColor); | ||
const error = errorType && ((_errors$errorType = errors[errorType]) !== null && _errors$errorType !== void 0 ? _errors$errorType : errors.default); | ||
const logos = "https://authjs.dev/img/providers"; | ||
return (0, _preact.h)("div", { | ||
@@ -65,9 +70,17 @@ className: "signin" | ||
} | ||
}), theme.logo && (0, _preact.h)("img", { | ||
}), theme.buttonText && (0, _preact.h)("style", { | ||
dangerouslySetInnerHTML: { | ||
__html: ` | ||
:root { | ||
--button-text-color: ${theme.buttonText} | ||
} | ||
` | ||
} | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, theme.logo && (0, _preact.h)("img", { | ||
src: theme.logo, | ||
alt: "Logo", | ||
className: "logo" | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, error && (0, _preact.h)("div", { | ||
}), error && (0, _preact.h)("div", { | ||
className: "error" | ||
@@ -101,7 +114,13 @@ }, (0, _preact.h)("p", null, error)), providersToRender.map((provider, i) => { | ||
}, ((_provider$style5 = provider.style) === null || _provider$style5 === void 0 ? void 0 : _provider$style5.logo) && (0, _preact.h)("img", { | ||
loading: "lazy", | ||
height: 24, | ||
width: 24, | ||
id: "provider-logo", | ||
src: provider.style.logo | ||
src: `${provider.style.logo.startsWith("/") ? logos : ""}${provider.style.logo}` | ||
}), ((_provider$style6 = provider.style) === null || _provider$style6 === void 0 ? void 0 : _provider$style6.logoDark) && (0, _preact.h)("img", { | ||
loading: "lazy", | ||
height: 24, | ||
width: 24, | ||
id: "provider-logo-dark", | ||
src: provider.style.logoDark | ||
src: `${provider.style.logo.startsWith("/") ? logos : ""}${provider.style.logoDark}` | ||
}), (0, _preact.h)("span", null, "Sign in with ", provider.name))), (provider.type === "email" || provider.type === "credentials") && i > 0 && providersToRender[i - 1].type !== "email" && providersToRender[i - 1].type !== "credentials" && (0, _preact.h)("hr", null), provider.type === "email" && (0, _preact.h)("form", { | ||
@@ -126,2 +145,3 @@ action: provider.signinUrl, | ||
}), (0, _preact.h)("button", { | ||
id: "submitButton", | ||
type: "submit" | ||
@@ -128,0 +148,0 @@ }, "Sign in with ", provider.name)), provider.type === "credentials" && (0, _preact.h)("form", { |
@@ -26,9 +26,17 @@ "use strict"; | ||
} | ||
}), theme.logo && (0, _preact.h)("img", { | ||
}), theme.buttonText && (0, _preact.h)("style", { | ||
dangerouslySetInnerHTML: { | ||
__html: ` | ||
:root { | ||
--button-text-color: ${theme.buttonText} | ||
} | ||
` | ||
} | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, theme.logo && (0, _preact.h)("img", { | ||
src: theme.logo, | ||
alt: "Logo", | ||
className: "logo" | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, (0, _preact.h)("h1", null, "Signout"), (0, _preact.h)("p", null, "Are you sure you want to sign out?"), (0, _preact.h)("form", { | ||
}), (0, _preact.h)("h1", null, "Signout"), (0, _preact.h)("p", null, "Are you sure you want to sign out?"), (0, _preact.h)("form", { | ||
action: `${url}/signout`, | ||
@@ -41,4 +49,5 @@ method: "POST" | ||
}), (0, _preact.h)("button", { | ||
id: "submitButton", | ||
type: "submit" | ||
}, "Sign out")))); | ||
} |
@@ -25,9 +25,9 @@ "use strict"; | ||
} | ||
}), theme.logo && (0, _preact.h)("img", { | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, theme.logo && (0, _preact.h)("img", { | ||
src: theme.logo, | ||
alt: "Logo", | ||
className: "logo" | ||
}), (0, _preact.h)("div", { | ||
className: "card" | ||
}, (0, _preact.h)("h1", null, "Check your email"), (0, _preact.h)("p", null, "A sign in link has been sent to your email address."), (0, _preact.h)("p", null, (0, _preact.h)("a", { | ||
}), (0, _preact.h)("h1", null, "Check your email"), (0, _preact.h)("p", null, "A sign in link has been sent to your email address."), (0, _preact.h)("p", null, (0, _preact.h)("a", { | ||
className: "site", | ||
@@ -34,0 +34,0 @@ href: url.origin |
@@ -450,3 +450,3 @@ import type { Adapter, AdapterUser } from "../adapters"; | ||
*/ | ||
generateSessionToken: () => string; | ||
generateSessionToken: () => Awaitable<string>; | ||
} | ||
@@ -453,0 +453,0 @@ export interface DefaultUser { |
@@ -1,1 +0,1 @@ | ||
module.exports = function() { return ":root{--border-width:1px;--border-radius:0.5rem;--color-error:#c94b4b;--color-info:#157efb;--color-info-text:#fff}.__next-auth-theme-auto,.__next-auth-theme-light{--color-background:#fff;--color-text:#000;--color-primary:#444;--color-control-border:#bbb;--color-button-active-background:#f9f9f9;--color-button-active-border:#aaa;--color-seperator:#ccc}.__next-auth-theme-dark{--color-background:#000;--color-text:#fff;--color-primary:#ccc;--color-control-border:#555;--color-button-active-background:#060606;--color-button-active-border:#666;--color-seperator:#444}@media (prefers-color-scheme:dark){.__next-auth-theme-auto{--color-background:#000;--color-text:#fff;--color-primary:#ccc;--color-control-border:#555;--color-button-active-background:#060606;--color-button-active-border:#666;--color-seperator:#444}}body{background-color:var(--color-background);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;margin:0;padding:0}h1{font-weight:400;margin-bottom:1.5rem;padding:0 1rem}h1,p{color:var(--color-text)}form{margin:0;padding:0}label{font-weight:500;margin-bottom:.25rem;text-align:left}input[type],label{color:var(--color-text);display:block}input[type]{background:var(--color-background);border:var(--border-width) solid var(--color-control-border);border-radius:var(--border-radius);box-shadow:inset 0 .1rem .2rem rgba(0,0,0,.2);box-sizing:border-box;font-size:1rem;padding:.5rem 1rem;width:100%}input[type]:focus{box-shadow:none}p{font-size:1.1rem;line-height:2rem;margin:0 0 1.5rem;padding:0 1rem}a.button{line-height:1rem;text-decoration:none}a.button:link,a.button:visited{background-color:var(--color-background);color:var(--color-primary)}a.button,button{align-items:center;background-color:var(--provider-bg,var(--color-background));border-color:rgba(0,0,0,.1);border-radius:var(--border-radius);box-shadow:0 0 0 0 #000,0 0 0 0 #000,0 10px 15px -3px rgba(0,0,0,.2),0 4px 6px -4px rgba(0,0,0,.1);color:var(--provider-color,var(--color-primary));display:flex;font-size:1.1rem;font-weight:500;justify-content:center;margin:0 0 .75rem;min-height:62px;padding:.75rem 1rem;position:relative;transition:all .1s ease-in-out}a.button:has(img),button:has(img){justify-content:unset}a.button:has(img) span,button:has(img) span{flex-grow:1}a.button:hover,button:hover{cursor:pointer}a.button:active,button:active{box-shadow:0 .15rem .3rem rgba(0,0,0,.15),inset 0 .1rem .2rem var(--color-background),inset 0 -.1rem .1rem rgba(0,0,0,.1);cursor:pointer}a.button #provider-logo,button #provider-logo{display:block}a.button #provider-logo-dark,button #provider-logo-dark{display:none}@media (prefers-color-scheme:dark){a.button,button{background-color:var(--provider-dark-bg,var(--color-background));border:1px solid #0d0d0d;box-shadow:0 0 0 0 #000,0 0 0 0 #ccc,0 5px 5px -3px hsla(0,0%,100%,.01),0 4px 6px -4px hsla(0,0%,100%,.05);color:var(--provider-dark-color,var(--color-primary))}#provider-logo{display:none!important}#provider-logo-dark{display:block!important}}a.site{color:var(--color-primary);font-size:1rem;line-height:2rem;text-decoration:none}a.site:hover{text-decoration:underline}.page{display:grid;height:100%;margin:0;padding:0;place-items:center;position:absolute;width:100%}.page>div{padding:.5rem;text-align:center}.error a.button{display:inline-block;margin-top:.5rem;padding-left:2rem;padding-right:2rem}.error .message{margin-bottom:1.5rem}.signin input[type=text]{display:block;margin-left:auto;margin-right:auto}.signin hr{border:0;border-top:1px solid var(--color-seperator);display:block;margin:1.5em auto 0;overflow:visible}.signin hr:before{background:var(--color-background);color:#888;content:\"or\";padding:0 .4rem;position:relative;top:-.6rem}.signin .error{background:#f5f5f5;background:var(--color-info);border-radius:.3rem;font-weight:500}.signin .error p{color:var(--color-info-text);font-size:.9rem;line-height:1.2rem;padding:.5rem 1rem;text-align:left}.signin form,.signin>div{display:block}.signin form input[type],.signin>div input[type]{margin-bottom:.5rem}.signin form button,.signin>div button{width:100%}.signin form,.signin>div{max-width:300px}.signout .message{margin-bottom:1.5rem}.logo{display:inline-block;margin-top:100px;max-height:150px;max-width:300px}.card{border:1px solid var(--color-control-border);border-radius:5px;margin:50px auto;max-width:-moz-max-content;max-width:max-content;padding:20px 50px}.card .header{color:var(--color-primary)}.section-header{color:var(--brand-color,var(--color-text))}" } | ||
module.exports = function() { return ":root{--border-width:1px;--border-radius:0.5rem;--color-error:#c94b4b;--color-info:#157efb;--color-info-text:#fff}.__next-auth-theme-auto,.__next-auth-theme-light{--color-background:#ececec;--color-background-card:#fff;--color-text:#000;--color-primary:#444;--color-control-border:#bbb;--color-button-active-background:#f9f9f9;--color-button-active-border:#aaa;--color-seperator:#ccc}.__next-auth-theme-dark{--color-background:#161b22;--color-background-card:#0d1117;--color-text:#fff;--color-primary:#ccc;--color-control-border:#555;--color-button-active-background:#060606;--color-button-active-border:#666;--color-seperator:#444}@media (prefers-color-scheme:dark){.__next-auth-theme-auto{--color-background:#161b22;--color-background-card:#0d1117;--color-text:#fff;--color-primary:#ccc;--color-control-border:#555;--color-button-active-background:#060606;--color-button-active-border:#666;--color-seperator:#444}}body{background-color:var(--color-background);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;margin:0;padding:0}h1{font-weight:400;margin-bottom:1.5rem;padding:0 1rem}h1,p{color:var(--color-text)}form{margin:0;padding:0}label{font-weight:500;margin-bottom:.25rem;text-align:left}input[type],label{color:var(--color-text);display:block}input[type]{background:var(--color-background-card);border:var(--border-width) solid var(--color-control-border);border-radius:var(--border-radius);box-sizing:border-box;font-size:1rem;padding:.5rem 1rem;width:100%}input[type]:focus{box-shadow:none}p{font-size:1.1rem;line-height:2rem;margin:0 0 1.5rem;padding:0 1rem}a.button{line-height:1rem;text-decoration:none}a.button:link,a.button:visited{background-color:var(--color-background);color:var(--color-primary)}button span{flex-grow:1}a.button,button{align-items:center;background-color:var(--provider-bg,var(--color-background-card));border-color:rgba(0,0,0,.1);border-radius:var(--border-radius);color:var(--provider-color,var(--color-primary));display:flex;font-size:1.1rem;font-weight:500;justify-content:center;margin:0 0 .75rem;min-height:62px;padding:.75rem 1rem;position:relative;transition:all .1s ease-in-out}@media (max-width:450px){a.button,button{font-size:.9rem}}a.button:active,a.button:hover,button:active,button:hover{cursor:pointer}a.button #provider-logo,button #provider-logo{display:block;width:25px}a.button #provider-logo-dark,button #provider-logo-dark{display:none}#submitButton{background-color:var(--brand-color,var(--color-info));color:var(--button-text-color,var(--color-info-text));width:100%}@media (prefers-color-scheme:dark){a.button,button{background-color:var(--provider-dark-bg,var(--color-background));color:var(--provider-dark-color,var(--color-primary))}#provider-logo{display:none!important}#provider-logo-dark{display:block!important;width:25px}}a.site{color:var(--color-primary);font-size:1rem;line-height:2rem;text-decoration:none}a.site:hover{text-decoration:underline}.page{display:grid;height:100%;margin:0;padding:0;place-items:center;position:absolute;width:100%}.page>div{text-align:center}.error a.button{display:inline-block;margin-top:.5rem;padding-left:2rem;padding-right:2rem}.error .message{margin-bottom:1.5rem}.signin input[type=text]{display:block;margin-left:auto;margin-right:auto}.signin hr{border:0;border-top:1px solid var(--color-seperator);display:block;margin:2rem auto 1rem;overflow:visible}.signin hr:before{background:var(--color-background-card);color:#888;content:\"or\";padding:0 .4rem;position:relative;top:-.7rem}.signin .error{background:#f5f5f5;background:var(--color-error);border-radius:.3rem;font-weight:500}.signin .error p{color:var(--color-info-text);font-size:.9rem;line-height:1.2rem;padding:.5rem 1rem;text-align:left}.signin form,.signin>div{display:block}.signin form input[type],.signin>div input[type]{margin-bottom:.5rem}.signin form button,.signin>div button{width:100%}.signin form,.signin>div{max-width:300px}.logo{display:inline-block;margin-bottom:25px;margin-top:20px;max-height:70px;max-width:150px}@media screen and (min-width:450px){.card{width:350px}}@media screen and (max-width:450px){.card{width:200px}}.card{background-color:var(--color-background-card);border-radius:30px;margin:20px 0;padding:20px 50px}.card .header{color:var(--color-primary)}.section-header{color:var(--color-text)}" } |
@@ -12,5 +12,10 @@ import type { GetServerSidePropsContext, NextApiRequest, NextApiResponse } from "next"; | ||
}; | ||
declare type GetServerSessionParams<O extends GetServerSessionOptions> = [GetServerSidePropsContext["req"], GetServerSidePropsContext["res"], O] | [NextApiRequest, NextApiResponse, O] | [O] | []; | ||
export declare function getServerSession<O extends GetServerSessionOptions, R = O["callbacks"] extends { | ||
session: (...args: any[]) => infer U; | ||
} ? U : Session>(...args: GetServerSessionParams<O>): Promise<R | null>; | ||
/** @deprecated renamed to `getServerSession` */ | ||
export declare function unstable_getServerSession<O extends GetServerSessionOptions, R = O["callbacks"] extends { | ||
session: (...args: any[]) => infer U; | ||
} ? U : Session>(...args: [GetServerSidePropsContext["req"], GetServerSidePropsContext["res"], O] | [NextApiRequest, NextApiResponse, O] | [O] | []): Promise<R | null>; | ||
} ? U : Session>(...args: GetServerSessionParams<O>): Promise<R | null>; | ||
declare global { | ||
@@ -17,0 +22,0 @@ namespace NodeJS { |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
exports.getServerSession = getServerSession; | ||
exports.unstable_getServerSession = unstable_getServerSession; | ||
@@ -58,5 +59,38 @@ | ||
async function NextAuthRouteHandler(req, context, options) { | ||
var _context$params, _query$error; | ||
const { | ||
headers, | ||
cookies | ||
} = require("next/headers"); | ||
const nextauth = (_context$params = context.params) === null || _context$params === void 0 ? void 0 : _context$params.nextauth; | ||
const query = Object.fromEntries(req.nextUrl.searchParams); | ||
const internalResponse = await (0, _core.AuthHandler)({ | ||
req: { | ||
host: (0, _detectHost.detectHost)(req.headers["x-forwarded-host"]), | ||
body: await (0, _utils.getBody)(req), | ||
query, | ||
cookies: Object.fromEntries(cookies().getAll().map(c => [c.name, c.value])), | ||
headers: Object.fromEntries(headers()), | ||
method: req.method, | ||
action: nextauth === null || nextauth === void 0 ? void 0 : nextauth[0], | ||
providerId: nextauth === null || nextauth === void 0 ? void 0 : nextauth[1], | ||
error: (_query$error = query.error) !== null && _query$error !== void 0 ? _query$error : nextauth === null || nextauth === void 0 ? void 0 : nextauth[1] | ||
}, | ||
options | ||
}); | ||
return (0, _utils.toResponse)(internalResponse); | ||
} | ||
function NextAuth(...args) { | ||
if (args.length === 1) { | ||
return async (req, res) => await NextAuthHandler(req, res, args[0]); | ||
return async (req, res) => { | ||
if (res.params) { | ||
return await NextAuthRouteHandler(req, res, args[0]); | ||
} | ||
return await NextAuthHandler(req, res, args[0]); | ||
}; | ||
} | ||
@@ -69,17 +103,11 @@ | ||
exports.default = _default; | ||
let experimentalWarningShown = false; | ||
let experimentalRSCWarningShown = false; | ||
async function unstable_getServerSession(...args) { | ||
async function getServerSession(...args) { | ||
var _options$secret2; | ||
if (!experimentalWarningShown && process.env.NODE_ENV !== "production") { | ||
console.warn("[next-auth][warn][EXPERIMENTAL_API]", "\n`unstable_getServerSession` is experimental and may be removed or changed in the future, as the name suggested.", `\nhttps://next-auth.js.org/configuration/nextjs#unstable_getServerSession}`, `\nhttps://next-auth.js.org/warnings#EXPERIMENTAL_API`); | ||
experimentalWarningShown = true; | ||
} | ||
const isRSC = args.length === 0 || args.length === 1; | ||
if (!experimentalRSCWarningShown && isRSC && process.env.NODE_ENV !== "production") { | ||
console.warn("[next-auth][warn][EXPERIMENTAL_API]", "\n`unstable_getServerSession` is used in a React Server Component.", `\nhttps://next-auth.js.org/configuration/nextjs#unstable_getServerSession}`, `\nhttps://next-auth.js.org/warnings#EXPERIMENTAL_API`); | ||
console.warn("[next-auth][warn][EXPERIMENTAL_API]", "\n`getServerSession` is used in a React Server Component.", `\nhttps://next-auth.js.org/configuration/nextjs#getServerSession}`, `\nhttps://next-auth.js.org/warnings#EXPERIMENTAL_API`); | ||
experimentalRSCWarningShown = true; | ||
@@ -148,2 +176,13 @@ } | ||
return null; | ||
} | ||
let deprecatedWarningShown = false; | ||
async function unstable_getServerSession(...args) { | ||
if (!deprecatedWarningShown && process.env.NODE_ENV !== "production") { | ||
console.warn("`unstable_getServerSession` has been renamed to `getServerSession`."); | ||
deprecatedWarningShown = true; | ||
} | ||
return await getServerSession(...args); | ||
} |
import { Cookie } from "../core/lib/cookie"; | ||
import { type ResponseInternal } from "../core"; | ||
export declare function setCookie(res: any, cookie: Cookie): void; | ||
export declare function getBody(req: Request): Promise<Record<string, any> | undefined>; | ||
export declare function toResponse(res: ResponseInternal): Response; |
@@ -6,3 +6,5 @@ "use strict"; | ||
}); | ||
exports.getBody = getBody; | ||
exports.setCookie = setCookie; | ||
exports.toResponse = toResponse; | ||
@@ -28,2 +30,44 @@ var _cookie = require("cookie"); | ||
res.setHeader("Set-Cookie", setCookieHeader); | ||
} | ||
async function getBody(req) { | ||
if (!("body" in req) || !req.body || req.method !== "POST") return; | ||
const contentType = req.headers.get("content-type"); | ||
if (contentType !== null && contentType !== void 0 && contentType.includes("application/json")) { | ||
return await req.json(); | ||
} else if (contentType !== null && contentType !== void 0 && contentType.includes("application/x-www-form-urlencoded")) { | ||
const params = new URLSearchParams(await req.text()); | ||
return Object.fromEntries(params); | ||
} | ||
} | ||
function toResponse(res) { | ||
var _res$headers, _res$cookies, _res$status; | ||
const headers = new Headers((_res$headers = res.headers) === null || _res$headers === void 0 ? void 0 : _res$headers.reduce((acc, { | ||
key, | ||
value | ||
}) => { | ||
acc[key] = value; | ||
return acc; | ||
}, {})); | ||
(_res$cookies = res.cookies) === null || _res$cookies === void 0 ? void 0 : _res$cookies.forEach(cookie => { | ||
const { | ||
name, | ||
value, | ||
options | ||
} = cookie; | ||
const cookieHeader = (0, _cookie.serialize)(name, value, options); | ||
if (headers.has("Set-Cookie")) headers.append("Set-Cookie", cookieHeader);else headers.set("Set-Cookie", cookieHeader); | ||
}); | ||
let body = res.body; | ||
if (headers.get("content-type") === "application/json") body = JSON.stringify(res.body);else if (headers.get("content-type") === "application/x-www-form-urlencoded") body = new URLSearchParams(res.body).toString(); | ||
const status = res.redirect ? 302 : (_res$status = res.status) !== null && _res$status !== void 0 ? _res$status : 200; | ||
const response = new Response(body, { | ||
headers, | ||
status | ||
}); | ||
if (res.redirect) response.headers.set("Location", res.redirect); | ||
return response; | ||
} |
{ | ||
"name": "next-auth", | ||
"version": "0.0.0-pr.6132.47cee00f", | ||
"version": "0.0.0-pr.6777.faa4ea2a", | ||
"description": "Authentication for Next.js", | ||
@@ -57,8 +57,8 @@ "homepage": "https://next-auth.js.org", | ||
"dependencies": { | ||
"@babel/runtime": "^7.16.3", | ||
"@panva/hkdf": "^1.0.1", | ||
"@babel/runtime": "^7.20.13", | ||
"@panva/hkdf": "^1.0.2", | ||
"cookie": "^0.5.0", | ||
"jose": "^4.9.3", | ||
"jose": "^4.11.4", | ||
"oauth": "^0.9.15", | ||
"openid-client": "^5.1.0", | ||
"openid-client": "^5.4.0", | ||
"preact": "^10.6.3", | ||
@@ -111,3 +111,3 @@ "preact-render-to-string": "^5.1.19", | ||
"msw": "^0.42.3", | ||
"next": "13.0.6", | ||
"next": "13.1.7-canary.22", | ||
"postcss": "^8.4.14", | ||
@@ -120,5 +120,2 @@ "postcss-cli": "^9.1.0", | ||
}, | ||
"engines": { | ||
"node": "^12.19.0 || ^14.15.0 || ^16.13.0 || ^18.12.0" | ||
}, | ||
"scripts": { | ||
@@ -125,0 +122,0 @@ "build": "pnpm clean && pnpm build:js && pnpm build:css", |
@@ -33,4 +33,4 @@ "use strict"; | ||
style: { | ||
logo: 'https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/apple.svg', | ||
logoDark: 'https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/apple-dark.svg', | ||
logo: "/apple.svg", | ||
logoDark: "/apple-dark.svg", | ||
bg: "#fff", | ||
@@ -37,0 +37,0 @@ text: "#000", |
@@ -33,4 +33,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/atlassian.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/atlassian-dark.svg", | ||
logo: "/atlassian.svg", | ||
logoDark: "/atlassian-dark.svg", | ||
bg: "#0052cc", | ||
@@ -37,0 +37,0 @@ text: "#fff", |
@@ -32,4 +32,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/auth0.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/auth0-dark.svg", | ||
logo: "/auth0.svg", | ||
logoDark: "/auth0-dark.svg", | ||
bg: "#fff", | ||
@@ -36,0 +36,0 @@ text: "#EB5424", |
@@ -33,4 +33,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/azure.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/azure-dark.svg", | ||
logo: "/azure.svg", | ||
logoDark: "/azure-dark.svg", | ||
bg: "#fff", | ||
@@ -37,0 +37,0 @@ text: "#0072c6", |
@@ -25,3 +25,5 @@ "use strict"; | ||
async profile(profile, tokens) { | ||
const profilePicture = await fetch(`https://graph.microsoft.com/v1.0/me/photos/${profilePhotoSize}x${profilePhotoSize}/$value`, { | ||
var _image; | ||
const response = await fetch(`https://graph.microsoft.com/v1.0/me/photos/${profilePhotoSize}x${profilePhotoSize}/$value`, { | ||
headers: { | ||
@@ -31,24 +33,23 @@ Authorization: `Bearer ${tokens.access_token}` | ||
}); | ||
let image; | ||
if (profilePicture.ok) { | ||
const pictureBuffer = await profilePicture.arrayBuffer(); | ||
const pictureBase64 = Buffer.from(pictureBuffer).toString("base64"); | ||
return { | ||
id: profile.sub, | ||
name: profile.name, | ||
email: profile.email, | ||
image: `data:image/jpeg;base64, ${pictureBase64}` | ||
}; | ||
} else { | ||
return { | ||
id: profile.sub, | ||
name: profile.name, | ||
email: profile.email | ||
}; | ||
if (response.ok && typeof Buffer !== "undefined") { | ||
try { | ||
const pictureBuffer = await response.arrayBuffer(); | ||
const pictureBase64 = Buffer.from(pictureBuffer).toString("base64"); | ||
image = `data:image/jpeg;base64, ${pictureBase64}`; | ||
} catch (_unused) {} | ||
} | ||
return { | ||
id: profile.sub, | ||
name: profile.name, | ||
email: profile.email, | ||
image: (_image = image) !== null && _image !== void 0 ? _image : null | ||
}; | ||
}, | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/azure.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/azure-dark.svg", | ||
logo: "/azure.svg", | ||
logoDark: "/azure-dark.svg", | ||
bg: "#fff", | ||
@@ -55,0 +56,0 @@ text: "#0072c6", |
@@ -25,4 +25,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/battlenet.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/battlenet-dark.svg", | ||
logo: "/battlenet.svg", | ||
logoDark: "/battlenet-dark.svg", | ||
bg: "#fff", | ||
@@ -29,0 +29,0 @@ text: "#148eff", |
@@ -27,4 +27,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/box.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/box-dark.svg", | ||
logo: "/box.svg", | ||
logoDark: "/box-dark.svg", | ||
bg: "#fff", | ||
@@ -31,0 +31,0 @@ text: "#0075C9", |
@@ -26,4 +26,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/cognito.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/cognito.svg", | ||
logo: "/cognito.svg", | ||
logoDark: "/cognito.svg", | ||
bg: "#fff", | ||
@@ -30,0 +30,0 @@ text: "#C17B9E", |
@@ -35,4 +35,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/discord.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/discord-dark.svg", | ||
logo: "/discord.svg", | ||
logoDark: "/discord-dark.svg", | ||
bg: "#fff", | ||
@@ -39,0 +39,0 @@ text: "#7289DA", |
@@ -45,4 +45,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/facebook.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/facebook-dark.svg", | ||
logo: "/facebook.svg", | ||
logoDark: "/facebook-dark.svg", | ||
bg: "#fff", | ||
@@ -49,0 +49,0 @@ text: "#006aff", |
@@ -68,4 +68,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/foursquare.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/foursquare-dark.svg", | ||
logo: "/foursquare.svg", | ||
logoDark: "/foursquare-dark.svg", | ||
bg: "#fff", | ||
@@ -72,0 +72,0 @@ text: "#000", |
@@ -30,4 +30,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/freshbooks.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/freshbooks-dark.svg", | ||
logo: "/freshbooks.svg", | ||
logoDark: "/freshbooks-dark.svg", | ||
bg: "#fff", | ||
@@ -34,0 +34,0 @@ text: "#0075dd", |
@@ -61,4 +61,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/github.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/github-dark.svg", | ||
logo: "/github.svg", | ||
logoDark: "/github-dark.svg", | ||
bg: "#fff", | ||
@@ -65,0 +65,0 @@ bgDark: "#000", |
@@ -35,4 +35,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/gitlab.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/gitlab-dark.svg", | ||
logo: "/gitlab.svg", | ||
logoDark: "/gitlab-dark.svg", | ||
bg: "#fff", | ||
@@ -39,0 +39,0 @@ text: "#FC6D26", |
@@ -32,4 +32,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/google.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/google.svg", | ||
logo: "/google.svg", | ||
logoDark: "/google.svg", | ||
bgDark: "#fff", | ||
@@ -36,0 +36,0 @@ bg: "#fff", |
@@ -56,4 +56,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/hubspot.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/hubspot-dark.svg", | ||
logo: "/hubspot.svg", | ||
logoDark: "/hubspot-dark.svg", | ||
bg: "#fff", | ||
@@ -60,0 +60,0 @@ text: "#ff7a59", |
@@ -30,4 +30,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/instagram.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/instagram.svg", | ||
logo: "/instagram.svg", | ||
logoDark: "/instagram.svg", | ||
bg: "#fff", | ||
@@ -34,0 +34,0 @@ text: "#000", |
@@ -34,4 +34,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/keycloak.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/keycloak.svg", | ||
logo: "/keycloak.svg", | ||
logoDark: "/keycloak.svg", | ||
bg: "#fff", | ||
@@ -38,0 +38,0 @@ text: "#000", |
@@ -34,4 +34,4 @@ "use strict"; | ||
style: { | ||
logo: 'https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/line.svg', | ||
logoDark: 'https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/line.svg', | ||
logo: "/line.svg", | ||
logoDark: "/line.svg", | ||
bg: "#fff", | ||
@@ -38,0 +38,0 @@ text: "#00C300", |
@@ -48,4 +48,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/linkedin.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/linkedin-dark.svg", | ||
logo: "/linkedin.svg", | ||
logoDark: "/linkedin-dark.svg", | ||
bg: "#fff", | ||
@@ -52,0 +52,0 @@ text: "#069", |
@@ -27,4 +27,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/mailchimp.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/mailchimp-dark.svg", | ||
logo: "/mailchimp.svg", | ||
logoDark: "/mailchimp-dark.svg", | ||
bg: "#fff", | ||
@@ -31,0 +31,0 @@ text: "#000", |
@@ -33,4 +33,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/okta.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/okta-dark.svg", | ||
logo: "/okta.svg", | ||
logoDark: "/okta-dark.svg", | ||
bg: "#fff", | ||
@@ -37,0 +37,0 @@ text: "#000", |
@@ -33,4 +33,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/patreon.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/patreon.svg", | ||
logo: "/patreon.svg", | ||
logoDark: "/patreon.svg", | ||
bg: "#fff", | ||
@@ -37,0 +37,0 @@ text: "#e85b46", |
@@ -30,4 +30,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/slack.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/slack.svg", | ||
logo: "/slack.svg", | ||
logoDark: "/slack.svg", | ||
bg: "#fff", | ||
@@ -34,0 +34,0 @@ text: "#000", |
@@ -29,4 +29,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/spotify.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/spotify.svg", | ||
logo: "/spotify.svg", | ||
logoDark: "/spotify.svg", | ||
bg: "#fff", | ||
@@ -33,0 +33,0 @@ text: "#2ebd59", |
@@ -53,4 +53,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/todoist.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/todoist.svg", | ||
logo: "/todoist.svg", | ||
logoDark: "/todoist.svg", | ||
bg: "#fff", | ||
@@ -57,0 +57,0 @@ text: "#E44332", |
@@ -45,4 +45,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/trakt.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/trakt-dark.svg", | ||
logo: "/trakt.svg", | ||
logoDark: "/trakt-dark.svg", | ||
bg: "#fff", | ||
@@ -49,0 +49,0 @@ text: "#ED2224", |
@@ -38,4 +38,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/twitch.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/twitch-dark.svg", | ||
logo: "/twitch.svg", | ||
logoDark: "/twitch-dark.svg", | ||
bg: "#fff", | ||
@@ -42,0 +42,0 @@ text: "#65459B", |
@@ -30,4 +30,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/twitter.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/twitter-dark.svg", | ||
logo: "/twitter.svg", | ||
logoDark: "/twitter-dark.svg", | ||
bg: "#fff", | ||
@@ -95,4 +95,4 @@ text: "#1da1f2", | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/twitter.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/twitter-dark.svg", | ||
logo: "/twitter.svg", | ||
logoDark: "/twitter-dark.svg", | ||
bg: "#fff", | ||
@@ -99,0 +99,0 @@ text: "#1da1f2", |
@@ -34,4 +34,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/vk.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/vk-dark.svg", | ||
logo: "/vk.svg", | ||
logoDark: "/vk-dark.svg", | ||
bg: "#fff", | ||
@@ -38,0 +38,0 @@ text: "#07F", |
@@ -31,4 +31,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/wikimedia.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/wikimedia-dark.svg", | ||
logo: "/wikimedia.svg", | ||
logoDark: "/wikimedia-dark.svg", | ||
bg: "#fff", | ||
@@ -35,0 +35,0 @@ text: "#000", |
@@ -37,4 +37,4 @@ "use strict"; | ||
style: { | ||
logo: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/workos.svg", | ||
logoDark: "https://raw.githubusercontent.com/nextauthjs/next-auth/main/packages/next-auth/provider-logos/workos-dark.svg", | ||
logo: "/workos.svg", | ||
logoDark: "/workos-dark.svg", | ||
bg: "#fff", | ||
@@ -41,0 +41,0 @@ text: "#6363f1", |
Sorry, the diff of this file is not supported yet
10075
376312
+ Addedcaniuse-lite@1.0.30001697(transitive)
- Removedcaniuse-lite@1.0.30001699(transitive)
Updated@babel/runtime@^7.20.13
Updated@panva/hkdf@^1.0.2
Updatedjose@^4.11.4
Updatedopenid-client@^5.4.0