Compare commits

..

64 Commits

Author SHA1 Message Date
Balázs Orbán
079fbd27fa update in core 2022-12-31 08:51:19 +01:00
Balázs Orbán
c7101981bc Merge branch 'main' into fix/callbackJwtDocstringUpdate 2022-12-31 08:49:40 +01:00
Balázs Orbán
b0ecf4e861 chore: update lockfile 2022-12-31 08:41:32 +01:00
Balázs Orbán
5a73c6efa3 chore: clean up pr labeler 2022-12-31 08:32:48 +01:00
Thang Vu
4aec142525 chore: split apps to dev, examples, playgrounds (#6228)
* chore: dev -> dev/nextjs

* chore: move to /examples

* chore: move to playgrounds, add dev/sveltekit

* Update sync.yml

* chore: dev scripts
2022-12-31 07:17:42 +00:00
1337cookie
45f423ed5d chore: gitignore generated src/lib/pages/styles.ts (#6210)
* chore: gitignore generated src/lib/pages/styles.ts

* chore: gitignore generated styles.ts

* chore: gitignore generated styles.ts

* chore: remove generated styles.ts
2022-12-29 05:14:09 +01:00
1337cookie
2e52a89c52 docs: fix links to moved docs (#6196) 2022-12-27 16:10:31 +01:00
Zgîmbău Tudor
ecde35e9c4 docs: Fix hydration error for SSR example (#6202) 2022-12-27 16:09:10 +01:00
ndom91
5a51330d55 chore(docs): add turbo docs build dependency 2022-12-27 14:43:52 +01:00
Nico Domino
b2db3eabee chore(docs): fix build step (#6188)
* chore(docs): fix build step temporarily

* fix: turbo docs build
2022-12-27 01:10:38 +01:00
Carlos Galarza
3865e44c1e fix(core): typo in API reference (#6194) 2022-12-27 01:09:55 +01:00
Zgîmbău Tudor
9f5acc5749 docs: Fix the hooks code in oauth getting started (#6193)
* Fix the hooks code in oauth getting started

Fixes https://github.com/nextauthjs/next-auth/issues/6192

* Apply suggestions from code review

Co-authored-by: Nico Domino <yo@ndo.dev>

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Nico Domino <yo@ndo.dev>
2022-12-27 01:08:37 +01:00
Iswar Mondal
0bbc8246b8 docs: Fixed the broken link of Contributing Guide in README (#6191)
* Updated the Contributing Guide link in README file

* Replaced the Contributing Guide broken link in README
2022-12-26 19:38:33 +01:00
Thang Vu
511f66b0a8 chore: enable remote caching for GH actions (#6187) 2022-12-26 11:38:30 +00:00
Thang Vu
ae57199258 chore(examples): unify /protected path behavior for Sveltekit and N… (#6176)
chore(examples): unify `/protected` path behavior for Sveltekit and Next.js
2022-12-25 17:56:10 +07:00
Balázs Orbán
aad425fced docs: show property types 2022-12-25 09:53:53 +01:00
Balázs Orbán
8ef1010bb1 chore: attempt to fix supabase test
SUPABASE_SERVICE_ROLE_KEY could be an empty string
2022-12-25 06:38:29 +01:00
Balázs Orbán
950ca3169a chore: make supabase wget quite 2022-12-25 06:30:03 +01:00
Balázs Orbán
edbf0fc011 chore: revert concurrency 2022-12-25 06:19:20 +01:00
Balázs Orbán
46bac818fe chore: add concurrency to tests 2022-12-25 06:15:48 +01:00
Balázs Orbán
9e64eb0cdd chore: simplify turbo config 2022-12-25 06:15:27 +01:00
Balázs Orbán
955e379330 chore: format 2022-12-25 05:59:12 +01:00
Balázs Orbán
7be4461253 chore: don't minify output CSS 2022-12-25 05:58:43 +01:00
Balázs Orbán
c2e06dc445 chore: upgrade oauth4webapi 2022-12-25 05:58:08 +01:00
Balázs Orbán
4dd70a5f6f fix(ts): enable strict type checking 2022-12-25 05:55:25 +01:00
Balázs Orbán
98dbf56494 Merge branch 'main' of github.com:nextauthjs/next-auth 2022-12-25 05:19:32 +01:00
Balázs Orbán
6b4644f7e7 chore(adapters): refactor Supabase Adapter test 2022-12-25 05:18:53 +01:00
GitHub Actions
bcf909b69e chore(release): bump package version(s) [skip ci] 2022-12-24 16:39:23 +00:00
Balázs Orbán
4dcdd21242 fix(providers): add state check to Twitter by default
Fixes #6135
2022-12-24 17:16:22 +01:00
Balázs Orbán
137d993a13 chore(dev): upgrade next 2022-12-24 17:15:35 +01:00
Balázs Orbán
8dda662cd6 chore: fix issue validator path 2022-12-24 16:43:51 +01:00
Balázs Orbán
8a438bab32 Merge branch 'main' of github.com:nextauthjs/next-auth 2022-12-24 16:36:33 +01:00
Balázs Orbán
4aaad03e9c chore: fix issue validator 2022-12-24 16:36:30 +01:00
Fatih Aygün
4fa0d1fa2a fix(core): correctly normalize endpoint configuration (#6173) 2022-12-24 15:31:47 +00:00
Balázs Orbán
c081773667 chore: use classic PAT for example sync 2022-12-24 15:25:57 +00:00
Balázs Orbán
1ab0a2aed4 fix(adapters): correct peer dependency for Supabase Adapter
Fixes #6172
2022-12-24 15:23:29 +00:00
Balázs Orbán
cac9816d32 chore: update sync examples PAT 2022-12-24 15:19:27 +00:00
Balázs Orbán
65defc709e chore(examples): change to named import 2022-12-24 15:14:06 +00:00
Balázs Orbán
1601626d31 chore: prettier ignore generated file 2022-12-24 04:34:47 +01:00
Balázs Orbán
8c4f439279 fix: add package keywords 2022-12-24 04:32:10 +01:00
GitHub Actions
a3cc9cb5f8 chore(release): bump package version(s) [skip ci] 2022-12-24 03:15:11 +00:00
Balázs Orbán
0ad4be2809 fix(core): add header to README 2022-12-24 04:04:56 +01:00
Balázs Orbán
aea4aaf25f fix(sveltekit): add header to README 2022-12-24 04:04:49 +01:00
Balázs Orbán
9bd7bc8a47 chore: fix docs building 2022-12-24 03:43:32 +01:00
Balázs Orbán
bf8fc9ca94 chore: fix docs scripts 2022-12-24 03:39:57 +01:00
Balázs Orbán
7116248e87 chore: mark @auth/* as prereleases 2022-12-24 03:30:53 +01:00
Balázs Orbán
ef8f353d94 Merge branch 'main' of github.com:nextauthjs/next-auth 2022-12-24 03:26:10 +01:00
Balázs Orbán
01620f9b7c chore: drop older node.js versions, update pnpm 2022-12-24 03:26:07 +01:00
Balázs Orbán
87d41aff94 chore: re-add LICENSE as it seems to not be picked up 2022-12-24 02:22:29 +00:00
Balázs Orbán
2d21f5ea5e chore: remove LICENSE file in favor of .github
See: https://github.com/nextauthjs/.github
2022-12-24 02:21:52 +00:00
Balázs Orbán
adf7cae7a0 chore: gitignore eslintcache 2022-12-24 03:17:50 +01:00
Balázs Orbán
f9b75e0a39 chore: remove extra tsconfigs 2022-12-24 03:16:50 +01:00
Balázs Orbán
9d6f54539d chore: simplify eslint linting 2022-12-24 03:10:03 +01:00
Balázs Orbán
0e51c66e11 chore: remove package-level lint and format 2022-12-24 01:49:31 +01:00
Balázs Orbán
e47c3c81f1 chore: format 2022-12-24 01:47:46 +01:00
Balázs Orbán
d69edb8501 chore: tweak prettierignore 2022-12-24 01:46:17 +01:00
Balázs Orbán
e5c0e3513b chore: upgrade monorepo-release package 2022-12-24 01:33:50 +01:00
Balázs Orbán
ca208ce732 chore: remove husky 2022-12-24 01:33:20 +01:00
Balázs Orbán
dcb601987b Merge branch 'main' of github.com:nextauthjs/next-auth 2022-12-23 15:00:20 +01:00
Balázs Orbán
7fd799a9ac chore: only lint with prettier 2022-12-23 15:00:13 +01:00
Balázs Orbán
fdd5e2390d chore: format 2022-12-23 14:42:37 +01:00
Balázs Orbán
fdecbb59c4 chore: move all lint/format to top 2022-12-23 14:41:53 +01:00
Nico Domino
677d8a346f chore(docs): fix aloglia docusaurus.config.js settings (#6159)
* chore: fix docusaurus algolia config

* chore: add empty 03-core dir
2022-12-23 12:41:43 +01:00
=
f7b052a5fd fix(core): update CallbacksOptions.jwt docstring
Change description to reflect that JWT is encrypted by default
2022-11-15 19:43:39 +01:00
257 changed files with 6727 additions and 2737 deletions

70
.eslintignore Normal file
View File

@@ -0,0 +1,70 @@
.eslintrc.js
.cache-loader
.DS_Store
.pnpm-debug.log
.turbo
.vscode/generated*
/_work
/actions-runner
node_modules
patches
pnpm-lock.yaml
.github/actions/issue-validator/index.mjs
*.cjs
*.js
*.d.ts
*.d.ts.map
.svelte-kit
.next
.nuxt
# --------------- Docs ---------------
.docusaurus
build
docs/docs/reference/03-core
docs/docs/reference/04-sveltekit
static
# --------------- Packages ---------------
coverage
dist
# @auth/core
packages/core/src/providers/oauth-types.ts
packages/core/src/lib/pages/styles.ts
# @auth/sveltekit
packages/frameworks-sveltekit/package
packages/frameworks-sveltekit/vite.config.{js,ts}.timestamp-*
# next-auth
packages/next-auth/src/providers/oauth-types.ts
packages/next-auth/css/index.css
# Adapters
.branches
db.sqlite
dev.db
dynamodblocal-bin
firebase-debug.log
firestore-debug.log
migrations
test.schema.gql
# --------------- Apps ---------------
# Examples should have their own Prettier config since they are templates too
apps/example-sveltekit
# Development app
apps
# --------------- Tests ---------------
# TODO: these should be linted
packages/**/*test*

View File

@@ -1,31 +1,37 @@
// @ts-check
const path = require("path")
/** @type {import("eslint").ESLint.ConfigData} */
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: ["standard-with-typescript", "prettier"],
rules: {
camelcase: "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/restrict-template-expressions": "off",
},
env: { browser: true, es2022: true, node: true },
extends: ["eslint:recommended", "prettier"],
overrides: [
{
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: [
path.resolve(__dirname, "./packages/**/tsconfig.eslint.json"),
path.resolve(__dirname, "./packages/frameworks/**/tsconfig.json"),
path.resolve(__dirname, "./apps/**/tsconfig.json"),
],
project: ["./packages/**/tsconfig.json", "./apps/**/tsconfig.json"],
},
settings: { react: { version: "18" } },
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"standard-with-typescript",
"prettier",
],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
},
},
{
files: ["*.test.ts", "*.test.js"],
extends: ["plugin:jest/recommended"],
env: { jest: true },
},
{
@@ -34,7 +40,8 @@ module.exports = {
extends: ["plugin:@docusaurus/recommended"],
},
{
files: ["packages/core/src/**/*"],
// TODO: Expand to all packages
files: ["packages/{core,sveltekit}/*.ts"],
plugins: ["jsdoc"],
extends: ["plugin:jsdoc/recommended"],
rules: {
@@ -49,19 +56,20 @@ module.exports = {
},
},
{
files: ["packages/core/src/adapters.ts"],
rules: {
"@typescript-eslint/method-signature-style": "off",
files: ["packages/frameworks-sveltekit"],
plugins: ["svelte3"],
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
settings: {
"svelte3/typescript": () => require("typescript"),
},
parserOptions: { sourceType: "module", ecmaVersion: 2020 },
env: { browser: true, es2017: true, node: true },
},
],
plugins: ["jest"],
ignorePatterns: [
"**/dist/**",
"**/node_modules/**",
".eslintrc.js",
"**/.turbo/**",
"**/coverage/**",
"**/build/**",
],
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
ecmaFeatures: { jsx: true },
},
root: true,
}

View File

@@ -1 +1 @@
blank_issues_enabled: false
blank_issues_enabled: false

View File

@@ -8,7 +8,7 @@ merge of your pull request!
> _NOTE_:
>
> - It's a good idea to open an issue first to discuss potential changes.
> - Please make sure that you are _NOT_ opening a PR to fix a potential security vulnerability. Instead, please follow the [Security guidelines](../Security.md) to disclose the issue to us confidentially.
> - Please make sure that you are _NOT_ opening a PR to fix a potential security vulnerability. Instead, please follow the [Security guidelines](https://github.com/nextauthjs/.github/blob/main/SECURITY.md) to disclose the issue to us confidentially.
## ☕️ Reasoning
@@ -28,7 +28,7 @@ Fixes: INSERT_ISSUE_LINK_HERE
## 📌 Resources
- [Security guidelines](../Security.md)
- [Contributing guidelines](../CONTRIBUTING.md)
- [Code of conduct](../CODE_OF_CONDUCT.md)
- [Security guidelines](https://github.com/nextauthjs/.github/blob/main/SECURITY.md)
- [Contributing guidelines](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md)
- [Code of conduct](https://github.com/nextauthjs/.github/blob/main/CODE_OF_CONDUCT.md)
- [Contributing to Open Source](https://kcd.im/pull-request)

File diff suppressed because one or more lines are too long

View File

@@ -526,7 +526,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
root
ISC License
Copyright (c) 2018-2021, Iain Collins
Copyright (c) 2022-2023, Balázs Orbán
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -540,6 +540,7 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
tr46
MIT

View File

@@ -35,4 +35,3 @@ Upvoting issues to show your interest will help us prioritize and address them a
- [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)
- [Reporting a NextAuth.js bug](https://github.com/nextauthjs/next-auth/blob/main/.github/ISSUE_TEMPLATE/1_bug_framework.yml)
- [How to Contribute to Open Source (Next.js)](https://www.youtube.com/watch?v=cuoNzXFLitc)

View File

@@ -4,6 +4,7 @@ import * as github from "@actions/github"
// @ts-expect-error
import * as core from "@actions/core"
import { readFileSync } from "node:fs"
import { join } from "node:path"
const addReproductionLabel = "incomplete"
@@ -40,7 +41,13 @@ async function run() {
label: { name: newLabel },
} = payload
if (pull_request || !issue?.body || !process.env.GITHUB_TOKEN) return
if (
pull_request ||
!issue?.body ||
!process.env.GITHUB_TOKEN ||
!process.env.GITHUB_ACTION_PATH
)
return
const labels = issue.labels.map((l) => l.name)
// const isBugReport =
@@ -70,7 +77,10 @@ async function run() {
}),
client.issues.createComment({
...issueCommon,
body: readFileSync("repro.md", "utf8"),
body: readFileSync(
join(process.env.GITHUB_ACTION_PATH, "repro.md"),
"utf8"
),
}),
])
return core.info(

View File

@@ -1,74 +1,26 @@
# https://github.com/actions/labeler#create-githublabeleryml
test:
- test/**/*
- types/tests/**/*
providers:
- packages/next-auth/src/providers/**/*
- test/integration/**/*
adapters:
- packages/next-auth/src/adapters.ts
- packages/adapter-*/**
dgraph:
- packages/adapter-dgraph/**
dynamodb:
- packages/adapter-dynamodb/**
fauna:
- packages/adapter-fauna/**
firebase:
- packages/adapter-firebase/**
mikro-orm:
- packages/adapter-mikro-orm/**
mongodb:
- packages/adapter-mongodb/**
neo4j:
- packages/adapter-neo4j/**
pouchdb:
- packages/adapter-pouchdb/**
prisma:
- packages/adapter-prisma/**
sequelize:
- packages/adapter-sequelize/**
supabase:
- packages/adapter-supabase/**
typeorm-legacy:
- packages/adapter-typeorm-legacy/**
upstash-redis:
- packages/adapter-upstash-redis/**
xata:
- packages/adapter-xata/**
core:
- packages/next-auth/src/**/*
style:
- packages/next-auth/src/css/**/*
client:
- packages/next-auth/src/client/**/*
- packages/next-auth/src/react/**/*
pages:
- packages/next-auth/src/core/pages/**/*
TypeScript:
- packages/next-auth/src/**/types.ts
documentation:
- packages/docs/docs/**/*
adapters: ["packages/core/src/adapters.ts", "packages/adapter-*/**/*"]
core: ["packages/core/src/**/*"]
dgraph: ["packages/adapter-dgraph/**/*"]
documentation: ["packages/docs/docs/**/*"]
dynamodb: ["packages/adapter-dynamodb/**/*"]
examples: ["apps/examples/**/*"]
fauna: ["packages/adapter-fauna/**/*"]
firebase: ["packages/adapter-firebase/**/*"]
frameworks: ["packages/frameworks-*/**/*"]
legacy: ["packages/next-auth/**/*"]
mikro-orm: ["packages/adapter-mikro-orm/**/*"]
mongodb: ["packages/adapter-mongodb/**/*"]
neo4j: ["packages/adapter-neo4j/**/*"]
playgrounds: ["apps/playgrounds/**/*"]
pouchdb: ["packages/adapter-pouchdb/**/*"]
prisma: ["packages/adapter-prisma/**/*"]
providers: ["packages/core/src/providers/**/*"]
sequelize: ["packages/adapter-sequelize/**/*"]
solidjs: ["packages/frameworks-solid-start/**/*"]
supabase: ["packages/adapter-supabase/**/*"]
svelte: ["packages/frameworks-sveltekit/**/*"]
test: ["**test**/*"]
typeorm-legacy: ["packages/adapter-typeorm-legacy/**/*"]
upstash-redis: ["packages/adapter-upstash-redis/**/*"]
xata: ["packages/adapter-xata/**/*"]

4
.github/sync.yml vendored
View File

@@ -1,14 +1,14 @@
# Note that nextauthjs/next-auth-example syncs from the v4 branch
nextauthjs/sveltekit-auth-example:
- source: apps/example-sveltekit
- source: apps/examples/sveltekit
dest: .
deleteOrphaned: true
- .github/FUNDING.yml
- LICENSE
nextauthjs/next-auth-gatsby-example:
- source: apps/playground-gatsby
- source: apps/playgrounds/gatsby
dest: .
deleteOrphaned: true
- .github/FUNDING.yml

View File

@@ -20,8 +20,6 @@ jobs:
fetch-depth: 2
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 7.5.1
- name: Setup Node
uses: actions/setup-node@v3
with:
@@ -31,9 +29,12 @@ jobs:
run: pnpm install
- name: Run tests
run: pnpm test
timeout-minutes: 15
env:
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
# - name: Coverage
# uses: codecov/codecov-action@v1
# with:
@@ -53,8 +54,6 @@ jobs:
token: ${{ secrets.GH_PAT_CLASSIC }}
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 7.5.1
- name: Setup Node
uses: actions/setup-node@v3
with:
@@ -80,8 +79,6 @@ jobs:
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 7.5.1
- name: Setup Node
uses: actions/setup-node@v3
with:
@@ -112,4 +109,3 @@ jobs:
env:
VERSION: ${{ steps.determine-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

View File

@@ -14,6 +14,6 @@ jobs:
# Can update to v1 when https://github.com/BetaHuhn/repo-file-sync-action/issues/168 is resolved
uses: BetaHuhn/repo-file-sync-action@v1.16.5
with:
GH_PAT: ${{ secrets.SYNC_EXAMPLE_PAT }}
GH_PAT: ${{ secrets.GH_PAT_CLASSIC }}
SKIP_PR: true
ORIGINAL_MESSAGE: true

3
.gitignore vendored
View File

@@ -1,7 +1,7 @@
# Misc
.DS_Store
.npmrc
.eslintcache
.env
.env.local
.env.development.local
@@ -86,6 +86,7 @@ packages/core/*.d.ts
packages/core/*.d.ts.map
packages/core/lib
packages/core/providers
packages/core/src/lib/pages/styles.ts
docs/docs/reference/03-core
docs/docs/reference/04-sveltekit

1
.husky/.gitignore vendored
View File

@@ -1 +0,0 @@
_

View File

@@ -1,4 +0,0 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# npx pretty-quick --staged

67
.prettierignore Normal file
View File

@@ -0,0 +1,67 @@
.cache-loader
.DS_Store
.pnpm-debug.log
.turbo
.vscode/generated*
/_work
/actions-runner
node_modules
patches
pnpm-lock.yaml
.github/actions/issue-validator/index.mjs
*.d.ts
*.d.ts.map
.svelte-kit
.next
.nuxt
# --------------- Docs ---------------
.docusaurus
build
docs/docs/reference/03-core
docs/docs/reference/04-sveltekit
static
docs/providers.json
# --------------- Packages ---------------
coverage
dist
packages/**/*.cjs
packages/**/*.js
# @auth/core
packages/core/src/providers/oauth-types.ts
packages/core/src/lib/pages/styles.ts
# @auth/sveltekit
packages/frameworks-sveltekit/package
packages/frameworks-sveltekit/vite.config.{js,ts}.timestamp-*
# next-auth
packages/next-auth/src/providers/oauth-types.ts
packages/next-auth/css/index.css
# Adapters
.branches
db.sqlite
dev.db
dynamodblocal-bin
firebase-debug.log
firestore-debug.log
migrations
test.schema.gql
# --------------- Apps ---------------
# Examples should have their own Prettier config since they are templates too
apps/example-sveltekit
# Development app
apps/dev/prisma
apps/dev/migrations
apps/dev/typeorm

View File

@@ -12,5 +12,11 @@ module.exports = {
],
options: { printWidth: 150 },
},
{
files: ["**/*package.json"],
options: {
trailingComma: "none",
},
},
],
}

14
.vscode/settings.json vendored
View File

@@ -1,8 +1,8 @@
{
"files.exclude": {
"packages/core/{lib,providers,*.js,*.d.ts,*.d.ts.map}": true,
"packages/next-auth/{client,core,css,jwt,next,providers,react,utils,*.js,*.d.ts}": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"openInGitHub.remote.branch": "main",
}
"files.exclude": {
"packages/core/{lib,providers,*.js,*.d.ts,*.d.ts.map}": true,
"packages/next-auth/{client,core,css,jwt,next,providers,react,utils,*.js,*.d.ts}": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"openInGitHub.remote.branch": "main"
}

View File

@@ -3,16 +3,12 @@
"description": "Markdown link to OAuth 2 specification",
"scope": "typescript",
"prefix": "oauth2",
"body": [
"[OAuth 2](https://datatracker.ietf.org/doc/html/rfc6749)"
]
"body": ["[OAuth 2](https://datatracker.ietf.org/doc/html/rfc6749)"]
},
"oidc-spec": {
"description": "Markdown link to OpenID Connect specification",
"scope": "typescript",
"prefix": "oidc",
"body": [
"[OIDC](https://openid.net/specs/openid-connect-core-1_0.html)"
]
},
}
"body": ["[OIDC](https://openid.net/specs/openid-connect-core-1_0.html)"]
}
}

View File

@@ -12,4 +12,4 @@ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -1,4 +0,0 @@
{
"typescript.tsdk": "../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}

View File

@@ -1,14 +0,0 @@
import Header from 'components/header'
import Footer from 'components/footer'
export default function Layout ({ children }) {
return (
<>
<Header />
<main>
{children}
</main>
<Footer />
</>
)
}

4
apps/dev/nextjs/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"typescript.tsdk": "../../../node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}

View File

@@ -3,4 +3,4 @@
This folder contains a Next.js app using NextAuth.js for local development. See the following section on how to start:
[Setting up local environment
](https://github.com/nextauthjs/next-auth/blob/main/CONTRIBUTING.md#setting-up-local-environment)
](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md#setting-up-local-environment)

View File

@@ -0,0 +1,12 @@
import Header from "components/header"
import Footer from "components/footer"
export default function Layout({ children }) {
return (
<>
<Header />
<main>{children}</main>
<Footer />
</>
)
}

View File

@@ -1,7 +1,7 @@
{
"name": "next-auth-app",
"version": "1.0.0",
"description": "NextAuth.js Developer app",
"description": "Next.js + Auth.js Developer app",
"private": true,
"scripts": {
"clean": "rm -rf .next",
@@ -20,7 +20,7 @@
"@prisma/client": "^3",
"@supabase/supabase-js": "^2.0.5",
"faunadb": "^4",
"next": "13.0.6",
"next": "13.1.1",
"next-auth": "workspace:*",
"@auth/core": "workspace:*",
"nodemailer": "^6",

View File

@@ -1,17 +1,19 @@
import Layout from '../components/layout'
import Layout from "../components/layout"
export default function Page () {
export default function Page() {
return (
<Layout>
<h1>API Example</h1>
<p>The examples below show responses from the example API endpoints.</p>
<p><em>You must be signed in to see responses.</em></p>
<p>
<em>You must be signed in to see responses.</em>
</p>
<h2>Session</h2>
<p>/api/examples/session</p>
<iframe src='/api/examples/session' />
<iframe src="/api/examples/session" />
<h2>JSON Web Token</h2>
<p>/api/examples/jwt</p>
<iframe src='/api/examples/jwt' />
<iframe src="/api/examples/jwt" />
</Layout>
)
}

View File

@@ -0,0 +1,27 @@
import Layout from "../components/layout"
export default function Page() {
return (
<Layout>
<h1>Client Side Rendering</h1>
<p>
This page uses the <strong>useSession()</strong> React Hook in the{" "}
<strong>&lt;/Header&gt;</strong> component.
</p>
<p>
The <strong>useSession()</strong> React Hook easy to use and allows
pages to render very quickly.
</p>
<p>
The advantage of this approach is that session state is shared between
pages by using the <strong>Provider</strong> in <strong>_app.js</strong>{" "}
so that navigation between pages using <strong>useSession()</strong> is
very fast.
</p>
<p>
The disadvantage of <strong>useSession()</strong> is that it requires
client side JavaScript.
</p>
</Layout>
)
}

View File

@@ -1,11 +1,11 @@
import Layout from 'components/layout'
import Layout from "components/layout"
export default function Page () {
export default function Page() {
return (
<Layout>
<h1>NextAuth.js Example</h1>
<p>
This is an example site to demonstrate how to use{' '}
This is an example site to demonstrate how to use{" "}
<a href="https://authjs.dev">NextAuth.js</a> for authentication.
</p>
</Layout>

View File

@@ -1,6 +1,6 @@
import { unstable_getServerSession } from "next-auth/next"
import Layout from "../components/layout"
import { authOptions } from './api/auth/[...nextauth]';
import { authOptions } from "./api/auth/[...nextauth]"
export default function Page() {
// As this page uses Server Side Rendering, the `session` will be already

View File

@@ -27,6 +27,6 @@ iframe {
border: 1px solid #ccc;
height: 10rem;
width: 100%;
border-radius: .5rem;
border-radius: 0.5rem;
filter: invert(1);
}
}

View File

@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "esnext",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
@@ -25,14 +21,6 @@
}
]
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules",
"jest.config.js"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "jest.config.js"]
}

View File

@@ -1,22 +0,0 @@
import Layout from '../components/layout'
export default function Page () {
return (
<Layout>
<h1>Client Side Rendering</h1>
<p>
This page uses the <strong>useSession()</strong> React Hook in the <strong>&lt;/Header&gt;</strong> component.
</p>
<p>
The <strong>useSession()</strong> React Hook easy to use and allows pages to render very quickly.
</p>
<p>
The advantage of this approach is that session state is shared between pages by using the <strong>Provider</strong> in <strong>_app.js</strong> so
that navigation between pages using <strong>useSession()</strong> is very fast.
</p>
<p>
The disadvantage of <strong>useSession()</strong> is that it requires client side JavaScript.
</p>
</Layout>
)
}

View File

@@ -1,4 +1,8 @@
{
"name": "sveltekit-auth-app",
"version": "1.0.0",
"description": "SvelteKit + Auth.js Developer app",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",

View File

@@ -1,4 +1,4 @@
import SvelteKitAuth from "@auth/sveltekit"
import { SvelteKitAuth } from "@auth/sveltekit"
import GitHub from "@auth/core/providers/github"
import { GITHUB_ID, GITHUB_SECRET } from "$env/static/private"

View File

@@ -2,9 +2,18 @@
import { page } from "$app/stores"
</script>
{#if $page.data.session}
<h1>Protected page</h1>
<p>
This is a protected content. You can access this content because you are
signed in.
</p>
<p>Session expiry: {$page.data.session?.expires}</p>
{:else}
<h1>Access Denied</h1>
<p>
<a href="/auth/signin">
You must be signed in to view this page
</a>
</p>
{/if}

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,5 +0,0 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@@ -1,10 +0,0 @@
import { redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types"
export const load: PageLoad = async ({ parent }) => {
const { session } = await parent()
if (!session?.user) {
throw redirect(302, "/")
}
return {}
}

View File

@@ -37,7 +37,7 @@ NextAuth.js is an easy to implement, full-stack (client/server) open source auth
Go to [next-auth.js.org](https://next-auth.js.org) for more information and documentation.
> *NextAuth.js is not officially associated with Vercel or Next.js.*
> _NextAuth.js is not officially associated with Vercel or Next.js._
## Getting Started
@@ -67,7 +67,7 @@ You **can** skip configuring a database and come back to it later if you want.
For more information about setting up a database, please check out the following links:
* Docs: [next-auth.js.org/adapters/overview](https://next-auth.js.org/adapters/overview)
- Docs: [next-auth.js.org/adapters/overview](https://next-auth.js.org/adapters/overview)
### 3. Configure Authentication Providers
@@ -75,9 +75,9 @@ For more information about setting up a database, please check out the following
2. When setting up OAuth, in the developer admin page for each of your OAuth services, you should configure the callback URL to use a callback path of `{server}/api/auth/callback/{provider}`.
e.g. For Google OAuth you would use: `http://localhost:3000/api/auth/callback/google`
e.g. For Google OAuth you would use: `http://localhost:3000/api/auth/callback/google`
A list of configured providers and their callback URLs is available from the endpoint `/api/auth/providers`. You can find more information at https://next-auth.js.org/configuration/providers/oauth
A list of configured providers and their callback URLs is available from the endpoint `/api/auth/providers`. You can find more information at https://next-auth.js.org/configuration/providers/oauth
3. You can also choose to specify an SMTP server for passwordless sign in via email.
@@ -110,4 +110,3 @@ Follow the [Deployment documentation](https://next-auth.js.org/deployment)
## License
ISC

View File

@@ -11,4 +11,4 @@
.navItem {
display: inline-block;
margin-right: 1rem;
}
}

View File

@@ -11,10 +11,10 @@
top: 0;
opacity: 1;
overflow: hidden;
border-radius: 0 0 .6rem .6rem;
padding: .6rem 1rem;
border-radius: 0 0 0.6rem 0.6rem;
padding: 0.6rem 1rem;
margin: 0;
background-color: rgba(0,0,0,.05);
background-color: rgba(0, 0, 0, 0.05);
transition: all 0.2s ease-in;
}
@@ -26,13 +26,13 @@
.signedInText,
.notSignedInText {
position: absolute;
padding-top: .8rem;
padding-top: 0.8rem;
left: 1rem;
right: 6.5rem;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
display: inherit;
display: inherit;
z-index: 1;
line-height: 1.3rem;
}
@@ -55,13 +55,13 @@
.button,
.buttonPrimary {
float: right;
margin-right: -.4rem;
margin-right: -0.4rem;
font-weight: 500;
border-radius: .3rem;
border-radius: 0.3rem;
cursor: pointer;
font-size: 1rem;
line-height: 1.4rem;
padding: .7rem .8rem;
padding: 0.7rem 0.8rem;
position: relative;
z-index: 10;
background-color: transparent;
@@ -73,11 +73,11 @@
border-color: #346df1;
color: #fff;
text-decoration: none;
padding: .7rem 1.4rem;
padding: 0.7rem 1.4rem;
}
.buttonPrimary:hover {
box-shadow: inset 0 0 5rem rgba(0,0,0,0.2)
box-shadow: inset 0 0 5rem rgba(0, 0, 0, 0.2);
}
.navItems {
@@ -89,4 +89,4 @@
.navItem {
display: inline-block;
margin-right: 1rem;
}
}

Some files were not shown because too many files have changed in this diff Show More