mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
2 Commits
docs/api-r
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
190c5044be | ||
|
|
b204710b5b |
@@ -23,8 +23,8 @@ pnpm-lock.yaml
|
||||
|
||||
.docusaurus
|
||||
build
|
||||
docs/docs/reference/core
|
||||
docs/docs/reference/sveltekit
|
||||
docs/docs/reference/03-core
|
||||
docs/docs/reference/04-sveltekit
|
||||
static
|
||||
|
||||
# --------------- Packages ---------------
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/1_bug_framework.yml
vendored
2
.github/ISSUE_TEMPLATE/1_bug_framework.yml
vendored
@@ -30,7 +30,7 @@ body:
|
||||
Run this command in your project's root folder and paste the result:
|
||||
|
||||
```sh
|
||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth,@auth/*"
|
||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth"
|
||||
```
|
||||
Alternatively, you can manually gather the version information from your package.json for these packages: "next", "react" and "next-auth". Please also mention your OS and Node.js version, as well as the browser you are using.
|
||||
validations:
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/2_bug_provider.yml
vendored
3
.github/ISSUE_TEMPLATE/2_bug_provider.yml
vendored
@@ -58,7 +58,6 @@ body:
|
||||
- "Medium"
|
||||
- "Naver"
|
||||
- "Netlify"
|
||||
- "Notion"
|
||||
- "Okta"
|
||||
- "OneLogin"
|
||||
- "Osso"
|
||||
@@ -89,7 +88,7 @@ body:
|
||||
Run this command in your project's root folder and paste the result:
|
||||
|
||||
```sh
|
||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth,@auth/*"
|
||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth"
|
||||
```
|
||||
Alternatively, you can manually gather the version information from your package.json for these packages: "next", "react" and "next-auth". Please also mention your OS and Node.js version, as well as the browser you are using.
|
||||
validations:
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
2
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
@@ -44,7 +44,7 @@ body:
|
||||
Run this command in your project's root folder and paste the result:
|
||||
|
||||
```sh
|
||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth,@auth/*" && npx envinfo --npmPackages "@next-auth/*"
|
||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth" && npx envinfo --npmPackages "@next-auth/*"
|
||||
```
|
||||
Alternatively, if the above command did not work, we need the version of the following packages from your package.json: "next", "react", "next-auth" and your adapter. Please also mention your OS and Node.js version, as well as the browser you are using.
|
||||
validations:
|
||||
|
||||
13
.gitignore
vendored
13
.gitignore
vendored
@@ -34,10 +34,13 @@ packages/next-auth/utils
|
||||
packages/next-auth/core
|
||||
packages/next-auth/jwt
|
||||
packages/next-auth/react
|
||||
packages/next-auth/adapters.d.ts
|
||||
packages/next-auth/adapters.js
|
||||
packages/next-auth/index.d.ts
|
||||
packages/next-auth/index.js
|
||||
packages/next-auth/next
|
||||
packages/*/*.js
|
||||
packages/*/*.d.ts
|
||||
packages/*/*.d.ts.map
|
||||
packages/next-auth/middleware.d.ts
|
||||
packages/next-auth/middleware.js
|
||||
|
||||
# Development app
|
||||
apps/dev/src/css
|
||||
@@ -85,8 +88,8 @@ packages/core/src/providers/oauth-types.ts
|
||||
packages/core/lib
|
||||
packages/core/providers
|
||||
packages/core/src/lib/pages/styles.ts
|
||||
docs/docs/reference/core
|
||||
docs/docs/reference/sveltekit
|
||||
docs/docs/reference/03-core
|
||||
docs/docs/reference/04-sveltekit
|
||||
|
||||
|
||||
# SvelteKit
|
||||
|
||||
@@ -20,8 +20,8 @@ pnpm-lock.yaml
|
||||
|
||||
.docusaurus
|
||||
build
|
||||
docs/docs/reference/core
|
||||
docs/docs/reference/sveltekit
|
||||
docs/docs/reference/03-core
|
||||
docs/docs/reference/04-sveltekit
|
||||
static
|
||||
docs/providers.json
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ KEYCLOAK_ID=
|
||||
KEYCLOAK_SECRET=
|
||||
KEYCLOAK_ISSUER=
|
||||
|
||||
NOTION_ID=
|
||||
NOTION_SECRET=
|
||||
NOTION_REDIRECT_URI=
|
||||
|
||||
IDS4_ID=
|
||||
IDS4_SECRET=
|
||||
IDS4_ISSUER=
|
||||
|
||||
@@ -24,7 +24,6 @@ import Instagram from "@auth/core/providers/instagram"
|
||||
import Line from "@auth/core/providers/line"
|
||||
import LinkedIn from "@auth/core/providers/linkedin"
|
||||
import Mailchimp from "@auth/core/providers/mailchimp"
|
||||
import Notion from "@auth/core/providers/notion"
|
||||
// import Okta from "@auth/core/providers/okta"
|
||||
import Osu from "@auth/core/providers/osu"
|
||||
import Patreon from "@auth/core/providers/patreon"
|
||||
@@ -70,7 +69,7 @@ import WorkOS from "@auth/core/providers/workos"
|
||||
|
||||
export const authConfig: AuthConfig = {
|
||||
// adapter,
|
||||
debug: process.env.NODE_ENV !== "production",
|
||||
// debug: process.env.NODE_ENV !== "production",
|
||||
theme: {
|
||||
logo: "https://next-auth.js.org/img/logo/logo-sm.png",
|
||||
brandColor: "#1786fb",
|
||||
@@ -108,7 +107,6 @@ export const authConfig: AuthConfig = {
|
||||
Line({ clientId: process.env.LINE_ID, clientSecret: process.env.LINE_SECRET }),
|
||||
LinkedIn({ clientId: process.env.LINKEDIN_ID, clientSecret: process.env.LINKEDIN_SECRET }),
|
||||
Mailchimp({ clientId: process.env.MAILCHIMP_ID, clientSecret: process.env.MAILCHIMP_SECRET }),
|
||||
Notion({ clientId: process.env.NOTION_ID, clientSecret: process.env.NOTION_SECRET, redirectUri: process.env.NOTION_REDIRECT_URI }),
|
||||
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }),
|
||||
Osu({ clientId: process.env.OSU_CLIENT_ID, clientSecret: process.env.OSU_CLIENT_SECRET }),
|
||||
Patreon({ clientId: process.env.PATREON_ID, clientSecret: process.env.PATREON_SECRET }),
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
"name": "playground-nuxt",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "nuxt prepare && nuxt build",
|
||||
"dev": "nuxt prepare && export NODE_OPTIONS='--no-experimental-fetch' && nuxt dev",
|
||||
"build": "nuxt build",
|
||||
"dev": "export NODE_OPTIONS='--no-experimental-fetch' && nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview"
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/eslint-config": "^0.1.1",
|
||||
|
||||
@@ -22,7 +22,7 @@ Using a JWT to store the `refresh_token` is less secure than saving it in a data
|
||||
|
||||
#### JWT strategy
|
||||
|
||||
Using the [jwt](../../reference/core/interfaces/types.CallbacksOptions.md#jwt) and [session](../../reference/core/interfaces/types.CallbacksOptions.md#session) callbacks, we can persist OAuth tokens and refresh them when they expire.
|
||||
Using the [jwt](../../reference/03-core/interfaces/types.CallbacksOptions.md#jwt) and [session](../../reference/03-core/interfaces/types.CallbacksOptions.md#session) callbacks, we can persist OAuth tokens and refresh them when they expire.
|
||||
|
||||
Below is a sample implementation using Google's Identity Provider. Please note that the OAuth 2.0 request in the `refreshAccessToken()` function will vary between different providers, but the core logic should remain similar.
|
||||
|
||||
|
||||
@@ -139,10 +139,9 @@ Prisma supports MongoDB, and so does Auth.js. Following the instructions of the
|
||||
id String @id @default(auto()) @map("_id") @db.ObjectId
|
||||
```
|
||||
|
||||
2. The Native database type attribute to `@db.String` from `@db.Text` and userId to `@db.ObjectId`.
|
||||
2. The Native database type attribute to `@db.String` from `@db.Text`.
|
||||
|
||||
```prisma
|
||||
user_id String @db.ObjectId
|
||||
refresh_token String? @db.String
|
||||
access_token String? @db.String
|
||||
id_token String? @db.String
|
||||
|
||||
25
docs/docs/reference/index.md
Normal file
25
docs/docs/reference/index.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: Overview
|
||||
sidebar_label: Overview
|
||||
sidebar_position: 0
|
||||
---
|
||||
|
||||
## Core
|
||||
|
||||
## Providers
|
||||
|
||||
- OAuth/OIDC
|
||||
- Email/Passwordless
|
||||
- Credentials
|
||||
|
||||
## Database Adapters
|
||||
|
||||
## Frameworks
|
||||
|
||||
- Next.js
|
||||
- SvelteKit
|
||||
- SolidStart
|
||||
- Remix
|
||||
- Nuxt
|
||||
- Gatsby
|
||||
- etc.
|
||||
@@ -62,7 +62,7 @@ const docusaurusConfig = {
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
to: "/reference/core",
|
||||
to: "/reference/core/modules/main",
|
||||
// TODO: change to this when the overview page looks better.
|
||||
// to: "/reference",
|
||||
activeBasePath: "/reference",
|
||||
@@ -101,7 +101,7 @@ const docusaurusConfig = {
|
||||
announcementBar: {
|
||||
id: "new-major-announcement",
|
||||
content:
|
||||
"<a target='_blank' rel='noopener noreferrer' href='https://next-auth.js.org'>NextAuth.js</a> is becoming Auth.js! 🎉 We're creating Authentication for the Web. Everyone included. Starting with SvelteKit, check out <a href='/reference/sveltekit'>the docs</a>. Note, this site is under active development.",
|
||||
"<a target='_blank' rel='noopener noreferrer' href='https://next-auth.js.org'>NextAuth.js</a> is becoming Auth.js! 🎉 We're creating Authentication for the Web. Everyone included. Starting with SvelteKit, check out <a href='/reference/sveltekit'>the docs</a>.",
|
||||
backgroundColor: "#000",
|
||||
textColor: "#fff",
|
||||
},
|
||||
@@ -182,7 +182,10 @@ const docusaurusConfig = {
|
||||
lastVersion: "current",
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
remarkPlugins: [require("@sapphire/docusaurus-plugin-npm2yarn2pnpm").npm2yarn2pnpm],
|
||||
remarkPlugins: [
|
||||
require("@sapphire/docusaurus-plugin-npm2yarn2pnpm").npm2yarn2pnpm,
|
||||
require("remark-github"),
|
||||
],
|
||||
versions: {
|
||||
current: {
|
||||
label: "experimental",
|
||||
@@ -201,14 +204,20 @@ const docusaurusConfig = {
|
||||
{
|
||||
...typedocConfig,
|
||||
id: "core",
|
||||
plugin: [require.resolve("./typedoc-mdn-links")],
|
||||
watch: process.env.TYPEDOC_WATCH,
|
||||
entryPoints: ["index.ts", "adapters.ts", "errors.ts", "jwt.ts", "types.ts"].map((e) => `${coreSrc}/${e}`).concat(providers),
|
||||
plugin: ["./tyepdoc"],
|
||||
entryPoints: [
|
||||
"index.ts",
|
||||
"adapters.ts",
|
||||
"errors.ts",
|
||||
"jwt.ts",
|
||||
"types.ts",
|
||||
]
|
||||
.map((e) => `${coreSrc}/${e}`)
|
||||
.concat(providers),
|
||||
tsconfig: "../packages/core/tsconfig.json",
|
||||
out: "reference/core",
|
||||
sidebar: {
|
||||
indexLabel: "index",
|
||||
},
|
||||
out: "reference/03-core",
|
||||
watch: process.env.TYPEDOC_WATCH,
|
||||
includeExtension: false,
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -216,14 +225,14 @@ const docusaurusConfig = {
|
||||
{
|
||||
...typedocConfig,
|
||||
id: "sveltekit",
|
||||
plugin: [require.resolve("./typedoc-mdn-links")],
|
||||
watch: process.env.TYPEDOC_WATCH,
|
||||
entryPoints: ["index.ts", "client.ts"].map((e) => `../packages/frameworks-sveltekit/src/lib/${e}`),
|
||||
plugin: ["./tyepdoc"],
|
||||
entryPoints: ["index.ts", "client.ts"].map(
|
||||
(e) => `../packages/frameworks-sveltekit/src/lib/${e}`
|
||||
),
|
||||
tsconfig: "../packages/frameworks-sveltekit/tsconfig.json",
|
||||
out: "reference/sveltekit",
|
||||
sidebar: {
|
||||
indexLabel: "index",
|
||||
},
|
||||
out: "reference/04-sveltekit",
|
||||
watch: process.env.TYPEDOC_WATCH,
|
||||
includeExtension: false,
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"repository": "https://github.com/nextauthjs/next-auth",
|
||||
"name": "docs",
|
||||
"scripts": {
|
||||
"start": "TYPEDOC_WATCH=true docusaurus start --no-open",
|
||||
"start": "TYPEDOC_WATCH=true docusaurus start --no-open --port 8000",
|
||||
"dev": "pnpm providers && pnpm snippets && pnpm start",
|
||||
"build": "pnpm providers && docusaurus build",
|
||||
"docusaurus": "docusaurus",
|
||||
@@ -27,6 +27,7 @@
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-marquee-slider": "^1.1.5",
|
||||
"remark-github": "10.1.0",
|
||||
"styled-components": "5.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -36,9 +37,7 @@
|
||||
"@docusaurus/preset-classic": "2.2.0",
|
||||
"@docusaurus/theme-common": "2.2.0",
|
||||
"@docusaurus/types": "2.2.0",
|
||||
"docusaurus-plugin-typedoc": "1.0.0-next.2",
|
||||
"typedoc": "^0.23.24",
|
||||
"typedoc-plugin-markdown": "4.0.0-next.2"
|
||||
"docusaurus-plugin-typedoc": "^0.18.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
||||
@@ -14,28 +14,61 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
referenceSidebar: [
|
||||
"reference/index",
|
||||
{
|
||||
type: "category",
|
||||
label: "@auth/core",
|
||||
link: { type: "doc", id: "reference/core/index" },
|
||||
items: [{ type: "autogenerated", dirName: "reference/core" }],
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "reference/core/modules/main",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "autogenerated",
|
||||
dirName: "reference/03-core/modules",
|
||||
// See: https://github.com/facebook/docusaurus/issues/5689
|
||||
// exclude: ["index"],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Reflections",
|
||||
collapsed: true,
|
||||
className: "reflection-category", // See src/index.css
|
||||
items: [{ type: "autogenerated", dirName: "reference/03-core" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "@auth/sveltekit",
|
||||
link: { type: "doc", id: "reference/sveltekit/index" },
|
||||
items: [{ type: "autogenerated", dirName: "reference/sveltekit" }],
|
||||
link: { type: "doc", id: "reference/sveltekit/modules/main" },
|
||||
items: [
|
||||
{ type: "autogenerated", dirName: "reference/04-sveltekit/modules" },
|
||||
{
|
||||
type: "category",
|
||||
label: "Reflections",
|
||||
collapsed: true,
|
||||
className: "reflection-category", // See src/index.css
|
||||
items: [{ type: "autogenerated", dirName: "reference/04-sveltekit" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "@auth/solid-start",
|
||||
link: { type: "doc", id: "reference/solidstart/index" },
|
||||
items: [{ type: "autogenerated", dirName: "reference/04-solidstart" }],
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "reference/solidstart/index",
|
||||
},
|
||||
items: ["reference/solidstart/client", "reference/solidstart/protected"],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "@auth/nextjs",
|
||||
link: { type: "doc", id: "reference/nextjs/index" },
|
||||
link: {
|
||||
type: "doc",
|
||||
id: "reference/nextjs/index",
|
||||
},
|
||||
items: [
|
||||
"reference/nextjs/client",
|
||||
{
|
||||
|
||||
@@ -272,4 +272,27 @@ html[data-theme="dark"] #carbonads > span {
|
||||
html[data-theme="dark"] #carbonads .carbon-poweredby {
|
||||
color: #aaa;
|
||||
background: #1e2021;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This is a hack to hide the "Reflection" category and "main" module from the sidebar.
|
||||
This is because:
|
||||
1. opening any page under the "Reflection" category would hide the entire sidebar.
|
||||
2. the "main" module would show up twice.
|
||||
See sidebars.js
|
||||
*/
|
||||
.reflection-category,
|
||||
.theme-doc-sidebar-item-link-level-2 [href="/reference/core/modules/main"],
|
||||
.theme-doc-sidebar-item-link-level-2
|
||||
[href="/reference/sveltekit/modules/main"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*
|
||||
HACK: to hide the "Classes" header and duplicate items together with the "typedoc-plugin-markdown" patch.
|
||||
See: https://github.com/TypeStrong/typedoc/issues/2006
|
||||
*/
|
||||
/* h3.anchor + p:has(code, strong), */ /** hack did not work as it hides property types elsewhere */
|
||||
#classes {
|
||||
display: none;
|
||||
}
|
||||
|
||||
5
docs/static/img/providers/notion.svg
vendored
5
docs/static/img/providers/notion.svg
vendored
@@ -1,5 +0,0 @@
|
||||
<svg width="32" height="32" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Notion icon</title>
|
||||
<path d="M6.017 4.313l55.333 -4.087c6.797 -0.583 8.543 -0.19 12.817 2.917l17.663 12.443c2.913 2.14 3.883 2.723 3.883 5.053v68.243c0 4.277 -1.553 6.807 -6.99 7.193L24.467 99.967c-4.08 0.193 -6.023 -0.39 -8.16 -3.113L3.3 79.94c-2.333 -3.113 -3.3 -5.443 -3.3 -8.167V11.113c0 -3.497 1.553 -6.413 6.017 -6.8z" fill="#fff"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M61.35 0.227l-55.333 4.087C1.553 4.7 0 7.617 0 11.113v60.66c0 2.723 0.967 5.053 3.3 8.167l13.007 16.913c2.137 2.723 4.08 3.307 8.16 3.113l64.257 -3.89c5.433 -0.387 6.99 -2.917 6.99 -7.193V20.64c0 -2.21 -0.873 -2.847 -3.443 -4.733L74.167 3.143c-4.273 -3.107 -6.02 -3.5 -12.817 -2.917zM25.92 19.523c-5.247 0.353 -6.437 0.433 -9.417 -1.99L8.927 11.507c-0.77 -0.78 -0.383 -1.753 1.557 -1.947l53.193 -3.887c4.467 -0.39 6.793 1.167 8.54 2.527l9.123 6.61c0.39 0.197 1.36 1.36 0.193 1.36l-54.933 3.307 -0.68 0.047zM19.803 88.3V30.367c0 -2.53 0.777 -3.697 3.103 -3.893L86 22.78c2.14 -0.193 3.107 1.167 3.107 3.693v57.547c0 2.53 -0.39 4.67 -3.883 4.863l-60.377 3.5c-3.493 0.193 -5.043 -0.97 -5.043 -4.083zm59.6 -54.827c0.387 1.75 0 3.5 -1.75 3.7l-2.91 0.577v42.773c-2.527 1.36 -4.853 2.137 -6.797 2.137 -3.107 0 -3.883 -0.973 -6.21 -3.887l-19.03 -29.94v28.967l6.02 1.363s0 3.5 -4.857 3.5l-13.39 0.777c-0.39 -0.78 0 -2.723 1.357 -3.11l3.497 -0.97v-38.3L30.48 40.667c-0.39 -1.75 0.58 -4.277 3.3 -4.473l14.367 -0.967 19.8 30.327v-26.83l-5.047 -0.58c-0.39 -2.143 1.163 -3.7 3.103 -3.89l13.4 -0.78z" fill="#000"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,16 +1,23 @@
|
||||
{
|
||||
"excludeNotDocumented": true,
|
||||
"$schema": "https://typedoc.org/schema.json",
|
||||
"cleanOutputDir": true,
|
||||
"allReflectionsHaveOwnDocument": true,
|
||||
"disableSources": true,
|
||||
"hideBreadcrumbs": true,
|
||||
"excludeExternals": true,
|
||||
"excludeInternal": true,
|
||||
"excludeNotDocumented": true,
|
||||
"excludePrivate": true,
|
||||
"cleanOutputDir": true,
|
||||
"excludeProtected": true,
|
||||
"hideHierarchy": true,
|
||||
"gitRevision": "main",
|
||||
"hideBreadcrumbs": true,
|
||||
"hideGenerator": true,
|
||||
"intentionallyNotExported": [
|
||||
"ReturnTypes",
|
||||
"CallbackParameters",
|
||||
"JsonValue"
|
||||
],
|
||||
"readme": "none",
|
||||
"sort": ["kind", "static-first", "required-first", "alphabetical"],
|
||||
"kindSortOrder": [
|
||||
"Function",
|
||||
"TypeAlias",
|
||||
@@ -34,13 +41,5 @@
|
||||
"IndexSignature",
|
||||
"GetSignature",
|
||||
"SetSignature"
|
||||
],
|
||||
"readme": "none",
|
||||
"sort": [
|
||||
"kind",
|
||||
"static-first",
|
||||
"required-first",
|
||||
"alphabetical"
|
||||
],
|
||||
"symbolsWithOwnFile": "none"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
"prettier": "2.8.1",
|
||||
"prettier-plugin-svelte": "^2.8.1",
|
||||
"turbo": "1.6.3",
|
||||
"typedoc": "^0.23.22",
|
||||
"typedoc-plugin-markdown": "^3.14.0",
|
||||
"typescript": "4.9.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -62,6 +64,7 @@
|
||||
"undici": "5.11.0"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"typedoc-plugin-markdown@3.14.0": "patches/typedoc-plugin-markdown@3.14.0.patch",
|
||||
"@balazsorban/monorepo-release@0.1.8": "patches/@balazsorban__monorepo-release@0.1.8.patch"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* - [Getting started](https://authjs.dev/getting-started/introduction)
|
||||
* - [Most common use case guides](https://authjs.dev/guides)
|
||||
*
|
||||
* @module index
|
||||
* @module main
|
||||
*/
|
||||
|
||||
import { assertConfig } from "./lib/assert.js"
|
||||
|
||||
@@ -188,7 +188,7 @@ export async function AuthInternal<
|
||||
|
||||
/**
|
||||
* :::danger
|
||||
* This option is intended for framework authors.
|
||||
* This option is inteded for framework authors.
|
||||
* :::
|
||||
*
|
||||
* Auth.js comes with built-in {@link https://authjs.dev/concepts/security#csrf CSRF} protection, but
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function callback(params: {
|
||||
cookies.push(...authorizationResult.cookies)
|
||||
}
|
||||
|
||||
logger.debug("authorization result", authorizationResult)
|
||||
logger.debug("authroization result", authorizationResult)
|
||||
|
||||
const { profile, account, OAuthProfile } = authorizationResult
|
||||
|
||||
|
||||
@@ -7,16 +7,15 @@ export async function handleAuthorized(
|
||||
params: any,
|
||||
{ url, logger, callbacks: { signIn } }: InternalOptions
|
||||
) {
|
||||
url.pathname += "/error"
|
||||
try {
|
||||
const authorized = await signIn(params)
|
||||
if (!authorized) {
|
||||
url.pathname += "/error"
|
||||
logger.debug("User not authorized", params)
|
||||
url.searchParams.set("error", "AccessDenied")
|
||||
return { status: 403 as const, redirect: url.toString() }
|
||||
}
|
||||
} catch (e) {
|
||||
url.pathname += "/error"
|
||||
const error = new AuthorizedCallbackError(e as Error)
|
||||
logger.error(error)
|
||||
url.searchParams.set("error", "Configuration")
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
/**
|
||||
* <div style={{backgroundColor: "#000", display: "flex", justifyContent: "space-between", color: "#fff", padding: 16}}>
|
||||
* <span>Built-in <b>Notion</b> integration.</span>
|
||||
* <a href="https://notion.so">
|
||||
* <img style={{display: "block"}} src="https://authjs.dev/img/providers/notion.svg" height="48" width="48"/>
|
||||
* </a>
|
||||
* </div>
|
||||
*
|
||||
* ---
|
||||
* @module providers/notion
|
||||
*/
|
||||
|
||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
||||
|
||||
export interface Person extends Record<string, any> {
|
||||
email: string
|
||||
}
|
||||
|
||||
// https://developers.notion.com/reference/user
|
||||
export interface User extends Record<string, any> {
|
||||
object: "user" | "bot"
|
||||
id: string
|
||||
type: string
|
||||
name: string
|
||||
avatar_url: null | string
|
||||
person: Person
|
||||
owner?: {
|
||||
type: "workspace" | "user"
|
||||
workspace: string
|
||||
}
|
||||
workspace_name?: string | null
|
||||
}
|
||||
|
||||
export interface Owner {
|
||||
type: string
|
||||
user: User
|
||||
}
|
||||
|
||||
// Notion responds with an access_token + some additional information, which we define here
|
||||
// More info - https://developers.notion.com/docs/authorization#step-4-notion-responds-with-an-access_token-and-some-additional-information
|
||||
export interface NotionProfile extends Record<string, any> {
|
||||
access_token: string
|
||||
bot_id: string
|
||||
duplicated_template_id: string
|
||||
owner?: Owner
|
||||
workspace_icon: string
|
||||
workspace_id: number
|
||||
workspace_name: string
|
||||
}
|
||||
|
||||
// Any config required that isn't part of the `OAuthUserConfig` spec should belong here
|
||||
// For example, we must pass a `redirectUri` to the Notion API when requesting tokens, therefore we add it here
|
||||
interface AdditionalConfig {
|
||||
redirectUri: string
|
||||
}
|
||||
|
||||
const NOTION_HOST = "https://api.notion.com"
|
||||
const NOTION_API_VERSION = "2022-06-28"
|
||||
|
||||
/**
|
||||
* Add Notion login to your page.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* ```ts
|
||||
* import { Auth } from "@auth/core"
|
||||
* import Notion from "@auth/core/providers/notion"
|
||||
*
|
||||
* const request = new Request("https://example.com")
|
||||
* const response = await Auth(request, {
|
||||
* providers: [Notion({ clientId: "", clientSecret: "", redirectUri: "" })],
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* ## Resources
|
||||
* - [Notion Docs](https://developers.notion.com/docs)
|
||||
* - [Notion Authorization Docs](https://developers.notion.com/docs/authorization)
|
||||
* - [Notion Integrations](https://www.notion.so/my-integrations)
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* ## Notes
|
||||
* You need to select "Public Integration" on the configuration page to get an `oauth_id` and `oauth_secret`. Private integrations do not provide these details.
|
||||
* You must provide a `clientId` and `clientSecret` to use this provider, as-well as a redirect URI (due to this being required by Notion endpoint to fetch tokens).
|
||||
*
|
||||
* :::tip
|
||||
*
|
||||
* The Notion provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/notion.ts).
|
||||
* To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/providers/custom-provider#override-default-options).
|
||||
*
|
||||
* :::
|
||||
*
|
||||
* :::info **Disclaimer**
|
||||
*
|
||||
* If you think you found a bug in the default configuration, you can [open an issue](https://authjs.dev/new/provider-issue).
|
||||
*
|
||||
* Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from
|
||||
* the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec,
|
||||
* we might not pursue a resolution. You can ask for more help in [Discussions](https://authjs.dev/new/github-discussions).
|
||||
*
|
||||
* :::
|
||||
*/
|
||||
export default function NotionProvider<P extends NotionProfile>(
|
||||
options: OAuthUserConfig<P> & AdditionalConfig
|
||||
): OAuthConfig<P> {
|
||||
return {
|
||||
id: "notion",
|
||||
name: "Notion",
|
||||
type: "oauth",
|
||||
token: {
|
||||
url: `${NOTION_HOST}/v1/oauth/token`,
|
||||
},
|
||||
userinfo: {
|
||||
url: `${NOTION_HOST}/v1/users`,
|
||||
|
||||
// The result of this method will be the input to the `profile` callback.
|
||||
// We use a custom request handler, since we need to do things such as pass the "Notion-Version" header
|
||||
// More info: https://next-auth.js.org/configuration/providers/oauth
|
||||
async request(context) {
|
||||
const profile = await fetch(`${NOTION_HOST}/v1/users/me`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${context.tokens.access_token}`,
|
||||
"Notion-Version": NOTION_API_VERSION,
|
||||
},
|
||||
})
|
||||
|
||||
const {
|
||||
bot: {
|
||||
owner: { user },
|
||||
},
|
||||
} = await profile.json()
|
||||
|
||||
return user
|
||||
},
|
||||
},
|
||||
authorization: {
|
||||
params: {
|
||||
client_id: options.clientId,
|
||||
response_type: "code",
|
||||
owner: "user",
|
||||
redirect_uri: options.redirectUri,
|
||||
},
|
||||
url: `${NOTION_HOST}/v1/oauth/authorize`,
|
||||
},
|
||||
|
||||
async profile(profile, tokens) {
|
||||
return {
|
||||
id: profile.id,
|
||||
name: profile.name,
|
||||
email: profile.person.email,
|
||||
image: profile.avatar_url,
|
||||
}
|
||||
},
|
||||
style: {
|
||||
logo: "/notion.svg",
|
||||
logoDark: "/notion.svg",
|
||||
bg: "#fff",
|
||||
text: "#000",
|
||||
bgDark: "#fff",
|
||||
textDark: "#000",
|
||||
},
|
||||
options,
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@
|
||||
* return {
|
||||
* session: await event.locals.getSession()
|
||||
* };
|
||||
* };
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* What you return in the function `LayoutServerLoad` will be available inside the `$page` store, in the `data` property: `$page.data`.
|
||||
@@ -106,7 +106,7 @@
|
||||
* return {};
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* :::danger
|
||||
* Make sure to ALWAYS grab the session information from the parent instead of using the store in the case of a `PageLoad`.
|
||||
* Not doing so can lead to users being able to incorrectly access protected information in the case the `+layout.server.ts` does not run for that page load.
|
||||
@@ -130,14 +130,14 @@
|
||||
* The handle hook, available in `hooks.server.ts`, is a function that receives ALL requests sent to your SvelteKit webapp.
|
||||
* You may intercept them inside the handle hook, add and modify things in the request, block requests, etc.
|
||||
* Some readers may notice we are already using this handle hook for SvelteKitAuth which returns a handle itself, so we are going to use SvelteKit's sequence to provide middleware-like functions that set the handle hook.
|
||||
*
|
||||
*
|
||||
* ```ts
|
||||
* import { SvelteKitAuth } from '@auth/sveltekit';
|
||||
* import GitHub from '@auth/core/providers/github';
|
||||
* import { GITHUB_ID, GITHUB_SECRET } from '$env/static/private';
|
||||
* import { redirect, type Handle } from '@sveltejs/kit';
|
||||
* import { sequence } from '@sveltejs/kit/hooks';
|
||||
*
|
||||
*
|
||||
* async function authorization({ event, resolve }) {
|
||||
* // Protect any routes under /authenticated
|
||||
* if (event.url.pathname.startsWith('/authenticated')) {
|
||||
@@ -146,14 +146,14 @@
|
||||
* throw redirect(303, '/auth');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* // If the request is still here, just proceed as normally
|
||||
* const result = await resolve(event, {
|
||||
* transformPageChunk: ({ html }) => html
|
||||
* });
|
||||
* return result;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* // First handle authentication, then authorization
|
||||
* // Each function acts as a middleware, receiving the request handle
|
||||
* // And returning a handle which gets passed to the next function
|
||||
@@ -183,7 +183,7 @@
|
||||
* PRs to improve this documentation are welcome! See [this file](https://github.com/nextauthjs/next-auth/blob/main/packages/frameworks-sveltekit/src/lib/index.ts).
|
||||
* :::
|
||||
*
|
||||
* @module index
|
||||
* @module main
|
||||
*/
|
||||
|
||||
/// <reference types="@sveltejs/kit" />
|
||||
|
||||
23
patches/typedoc-plugin-markdown@3.14.0.patch
Normal file
23
patches/typedoc-plugin-markdown@3.14.0.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
diff --git a/dist/theme.js b/dist/theme.js
|
||||
index 1483a4b4ec69583aa3086eac83b2b31ae8bb6777..c30e7a4f7785fc230099e8b904040dd4aa57c38e 100644
|
||||
--- a/dist/theme.js
|
||||
+++ b/dist/theme.js
|
||||
@@ -221,12 +221,12 @@ class MarkdownTheme extends typedoc_1.Theme {
|
||||
directory: 'enums',
|
||||
template: this.getReflectionTemplate(),
|
||||
},
|
||||
- {
|
||||
- kind: [typedoc_1.ReflectionKind.Class],
|
||||
- isLeaf: false,
|
||||
- directory: 'classes',
|
||||
- template: this.getReflectionTemplate(),
|
||||
- },
|
||||
+ // {
|
||||
+ // kind: [typedoc_1.ReflectionKind.Class],
|
||||
+ // isLeaf: false,
|
||||
+ // directory: 'classes',
|
||||
+ // template: this.getReflectionTemplate(),
|
||||
+ // },
|
||||
{
|
||||
kind: [typedoc_1.ReflectionKind.Interface],
|
||||
isLeaf: false,
|
||||
1677
pnpm-lock.yaml
generated
1677
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -43,10 +43,6 @@
|
||||
},
|
||||
"@next-auth/upstash-redis-adapter#test": {
|
||||
"env": ["UPSTASH_REDIS_KEY", "UPSTASH_REDIS_URL"]
|
||||
},
|
||||
"docs#dev": {
|
||||
"dependsOn": ["^build"],
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user