mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
79 Commits
@auth/core
...
@auth/soli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6f5c4d1cf | ||
|
|
09a075cc7e | ||
|
|
f1475955ea | ||
|
|
e6f48775fa | ||
|
|
ba87e86d47 | ||
|
|
b0dd1fac93 | ||
|
|
054288316b | ||
|
|
5e02019a3c | ||
|
|
9da0e66193 | ||
|
|
287c8f0f91 | ||
|
|
87ed5077ad | ||
|
|
2cbf815445 | ||
|
|
d63166db3a | ||
|
|
f387793d71 | ||
|
|
b0ecf4e861 | ||
|
|
5a73c6efa3 | ||
|
|
4aec142525 | ||
|
|
45f423ed5d | ||
|
|
2e52a89c52 | ||
|
|
ecde35e9c4 | ||
|
|
5a51330d55 | ||
|
|
b2db3eabee | ||
|
|
3865e44c1e | ||
|
|
9f5acc5749 | ||
|
|
0bbc8246b8 | ||
|
|
511f66b0a8 | ||
|
|
ae57199258 | ||
|
|
aad425fced | ||
|
|
8ef1010bb1 | ||
|
|
950ca3169a | ||
|
|
edbf0fc011 | ||
|
|
46bac818fe | ||
|
|
9e64eb0cdd | ||
|
|
955e379330 | ||
|
|
7be4461253 | ||
|
|
c2e06dc445 | ||
|
|
4dd70a5f6f | ||
|
|
98dbf56494 | ||
|
|
6b4644f7e7 | ||
|
|
bcf909b69e | ||
|
|
4dcdd21242 | ||
|
|
137d993a13 | ||
|
|
8dda662cd6 | ||
|
|
8a438bab32 | ||
|
|
4aaad03e9c | ||
|
|
4fa0d1fa2a | ||
|
|
c081773667 | ||
|
|
1ab0a2aed4 | ||
|
|
cac9816d32 | ||
|
|
65defc709e | ||
|
|
1601626d31 | ||
|
|
8c4f439279 | ||
|
|
a3cc9cb5f8 | ||
|
|
0ad4be2809 | ||
|
|
aea4aaf25f | ||
|
|
9bd7bc8a47 | ||
|
|
bf8fc9ca94 | ||
|
|
7116248e87 | ||
|
|
ef8f353d94 | ||
|
|
01620f9b7c | ||
|
|
87d41aff94 | ||
|
|
2d21f5ea5e | ||
|
|
adf7cae7a0 | ||
|
|
f9b75e0a39 | ||
|
|
9d6f54539d | ||
|
|
0e51c66e11 | ||
|
|
e47c3c81f1 | ||
|
|
d69edb8501 | ||
|
|
e5c0e3513b | ||
|
|
ca208ce732 | ||
|
|
dcb601987b | ||
|
|
7fd799a9ac | ||
|
|
fdd5e2390d | ||
|
|
fdecbb59c4 | ||
|
|
677d8a346f | ||
|
|
aad0b8db0e | ||
|
|
137bbb8d84 | ||
|
|
d7fbd05eba | ||
|
|
532aa24495 |
70
.eslintignore
Normal file
70
.eslintignore
Normal 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*
|
||||||
66
.eslintrc.js
66
.eslintrc.js
@@ -1,31 +1,37 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
const path = require("path")
|
|
||||||
|
|
||||||
/** @type {import("eslint").ESLint.ConfigData} */
|
/** @type {import("eslint").ESLint.ConfigData} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
env: { browser: true, es2022: true, node: true },
|
||||||
parser: "@typescript-eslint/parser",
|
extends: ["eslint:recommended", "prettier"],
|
||||||
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",
|
|
||||||
},
|
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ["*.ts", "*.tsx"],
|
files: ["*.ts", "*.tsx"],
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: [
|
project: ["./packages/**/tsconfig.json", "./apps/**/tsconfig.json"],
|
||||||
path.resolve(__dirname, "./packages/**/tsconfig.eslint.json"),
|
},
|
||||||
path.resolve(__dirname, "./packages/frameworks/**/tsconfig.json"),
|
settings: { react: { version: "18" } },
|
||||||
path.resolve(__dirname, "./apps/**/tsconfig.json"),
|
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"],
|
files: ["*.test.ts", "*.test.js"],
|
||||||
|
extends: ["plugin:jest/recommended"],
|
||||||
env: { jest: true },
|
env: { jest: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -34,7 +40,8 @@ module.exports = {
|
|||||||
extends: ["plugin:@docusaurus/recommended"],
|
extends: ["plugin:@docusaurus/recommended"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["packages/core/src/**/*"],
|
// TODO: Expand to all packages
|
||||||
|
files: ["packages/{core,sveltekit}/*.ts"],
|
||||||
plugins: ["jsdoc"],
|
plugins: ["jsdoc"],
|
||||||
extends: ["plugin:jsdoc/recommended"],
|
extends: ["plugin:jsdoc/recommended"],
|
||||||
rules: {
|
rules: {
|
||||||
@@ -49,19 +56,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ["packages/core/src/adapters.ts"],
|
files: ["packages/frameworks-sveltekit"],
|
||||||
rules: {
|
plugins: ["svelte3"],
|
||||||
"@typescript-eslint/method-signature-style": "off",
|
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"],
|
parserOptions: {
|
||||||
ignorePatterns: [
|
sourceType: "module",
|
||||||
"**/dist/**",
|
ecmaVersion: "latest",
|
||||||
"**/node_modules/**",
|
ecmaFeatures: { jsx: true },
|
||||||
".eslintrc.js",
|
},
|
||||||
"**/.turbo/**",
|
root: true,
|
||||||
"**/coverage/**",
|
|
||||||
"**/build/**",
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1 +1 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
|
|||||||
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -8,7 +8,7 @@ merge of your pull request!
|
|||||||
> _NOTE_:
|
> _NOTE_:
|
||||||
>
|
>
|
||||||
> - It's a good idea to open an issue first to discuss potential changes.
|
> - 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
|
## ☕️ Reasoning
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ Fixes: INSERT_ISSUE_LINK_HERE
|
|||||||
|
|
||||||
## 📌 Resources
|
## 📌 Resources
|
||||||
|
|
||||||
- [Security guidelines](../Security.md)
|
- [Security guidelines](https://github.com/nextauthjs/.github/blob/main/SECURITY.md)
|
||||||
- [Contributing guidelines](../CONTRIBUTING.md)
|
- [Contributing guidelines](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md)
|
||||||
- [Code of conduct](../CODE_OF_CONDUCT.md)
|
- [Code of conduct](https://github.com/nextauthjs/.github/blob/main/CODE_OF_CONDUCT.md)
|
||||||
- [Contributing to Open Source](https://kcd.im/pull-request)
|
- [Contributing to Open Source](https://kcd.im/pull-request)
|
||||||
|
|||||||
2
.github/actions/issue-validator/index.mjs
vendored
2
.github/actions/issue-validator/index.mjs
vendored
File diff suppressed because one or more lines are too long
3
.github/actions/issue-validator/licenses.txt
vendored
3
.github/actions/issue-validator/licenses.txt
vendored
@@ -526,7 +526,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||||||
root
|
root
|
||||||
ISC License
|
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
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
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
|
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.
|
||||||
|
|
||||||
|
|
||||||
tr46
|
tr46
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
|
|||||||
1
.github/actions/issue-validator/repro.md
vendored
1
.github/actions/issue-validator/repro.md
vendored
@@ -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)
|
- [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)
|
- [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)
|
- [How to Contribute to Open Source (Next.js)](https://www.youtube.com/watch?v=cuoNzXFLitc)
|
||||||
|
|
||||||
|
|||||||
14
.github/actions/issue-validator/src/index.mjs
vendored
14
.github/actions/issue-validator/src/index.mjs
vendored
@@ -4,6 +4,7 @@ import * as github from "@actions/github"
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import * as core from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
import { readFileSync } from "node:fs"
|
import { readFileSync } from "node:fs"
|
||||||
|
import { join } from "node:path"
|
||||||
|
|
||||||
const addReproductionLabel = "incomplete"
|
const addReproductionLabel = "incomplete"
|
||||||
|
|
||||||
@@ -40,7 +41,13 @@ async function run() {
|
|||||||
label: { name: newLabel },
|
label: { name: newLabel },
|
||||||
} = payload
|
} = 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 labels = issue.labels.map((l) => l.name)
|
||||||
// const isBugReport =
|
// const isBugReport =
|
||||||
@@ -70,7 +77,10 @@ async function run() {
|
|||||||
}),
|
}),
|
||||||
client.issues.createComment({
|
client.issues.createComment({
|
||||||
...issueCommon,
|
...issueCommon,
|
||||||
body: readFileSync("repro.md", "utf8"),
|
body: readFileSync(
|
||||||
|
join(process.env.GITHUB_ACTION_PATH, "repro.md"),
|
||||||
|
"utf8"
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
return core.info(
|
return core.info(
|
||||||
|
|||||||
98
.github/pr-labeler.yml
vendored
98
.github/pr-labeler.yml
vendored
@@ -1,74 +1,26 @@
|
|||||||
# https://github.com/actions/labeler#create-githublabeleryml
|
# https://github.com/actions/labeler#create-githublabeleryml
|
||||||
|
adapters: ["packages/core/src/adapters.ts", "packages/adapter-*/**/*"]
|
||||||
test:
|
core: ["packages/core/src/**/*"]
|
||||||
- test/**/*
|
dgraph: ["packages/adapter-dgraph/**/*"]
|
||||||
- types/tests/**/*
|
documentation: ["packages/docs/docs/**/*"]
|
||||||
|
dynamodb: ["packages/adapter-dynamodb/**/*"]
|
||||||
providers:
|
examples: ["apps/examples/**/*"]
|
||||||
- packages/next-auth/src/providers/**/*
|
fauna: ["packages/adapter-fauna/**/*"]
|
||||||
- test/integration/**/*
|
firebase: ["packages/adapter-firebase/**/*"]
|
||||||
|
frameworks: ["packages/frameworks-*/**/*"]
|
||||||
adapters:
|
legacy: ["packages/next-auth/**/*"]
|
||||||
- packages/next-auth/src/adapters.ts
|
mikro-orm: ["packages/adapter-mikro-orm/**/*"]
|
||||||
- packages/adapter-*/**
|
mongodb: ["packages/adapter-mongodb/**/*"]
|
||||||
|
neo4j: ["packages/adapter-neo4j/**/*"]
|
||||||
dgraph:
|
playgrounds: ["apps/playgrounds/**/*"]
|
||||||
- packages/adapter-dgraph/**
|
pouchdb: ["packages/adapter-pouchdb/**/*"]
|
||||||
|
prisma: ["packages/adapter-prisma/**/*"]
|
||||||
dynamodb:
|
providers: ["packages/core/src/providers/**/*"]
|
||||||
- packages/adapter-dynamodb/**
|
sequelize: ["packages/adapter-sequelize/**/*"]
|
||||||
|
solidjs: ["packages/frameworks-solid-start/**/*"]
|
||||||
fauna:
|
supabase: ["packages/adapter-supabase/**/*"]
|
||||||
- packages/adapter-fauna/**
|
svelte: ["packages/frameworks-sveltekit/**/*"]
|
||||||
|
test: ["**test**/*"]
|
||||||
firebase:
|
typeorm-legacy: ["packages/adapter-typeorm-legacy/**/*"]
|
||||||
- packages/adapter-firebase/**
|
upstash-redis: ["packages/adapter-upstash-redis/**/*"]
|
||||||
|
xata: ["packages/adapter-xata/**/*"]
|
||||||
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/**/*
|
|
||||||
|
|||||||
14
.github/sync.yml
vendored
14
.github/sync.yml
vendored
@@ -1,14 +1,24 @@
|
|||||||
# Note that nextauthjs/next-auth-example syncs from the v4 branch
|
# Note that nextauthjs/next-auth-example syncs from the v4 branch
|
||||||
|
|
||||||
nextauthjs/sveltekit-auth-example:
|
nextauthjs/sveltekit-auth-example:
|
||||||
- source: apps/example-sveltekit
|
- source: apps/examples/sveltekit
|
||||||
dest: .
|
dest: .
|
||||||
deleteOrphaned: true
|
deleteOrphaned: true
|
||||||
- .github/FUNDING.yml
|
- .github/FUNDING.yml
|
||||||
- LICENSE
|
- LICENSE
|
||||||
|
|
||||||
|
# FIXME: Should re-enable, but currently fails:
|
||||||
|
# https://github.com/nextauthjs/next-auth/actions/runs/3811709391/jobs/6484533340
|
||||||
|
# (issue seems to be the name of the target repo)
|
||||||
|
# nextauthjs/solid-start-auth-example:
|
||||||
|
# - source: "apps/examples/solid-start"
|
||||||
|
# dest: .
|
||||||
|
# deleteOrphaned: true
|
||||||
|
# - .github/FUNDING.yml
|
||||||
|
# - LICENSE
|
||||||
|
|
||||||
nextauthjs/next-auth-gatsby-example:
|
nextauthjs/next-auth-gatsby-example:
|
||||||
- source: apps/playground-gatsby
|
- source: apps/playgrounds/gatsby
|
||||||
dest: .
|
dest: .
|
||||||
deleteOrphaned: true
|
deleteOrphaned: true
|
||||||
- .github/FUNDING.yml
|
- .github/FUNDING.yml
|
||||||
|
|||||||
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -20,8 +20,6 @@ jobs:
|
|||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.2.4
|
uses: pnpm/action-setup@v2.2.4
|
||||||
with:
|
|
||||||
version: 7.5.1
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@@ -31,9 +29,12 @@ jobs:
|
|||||||
run: pnpm install
|
run: pnpm install
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pnpm test
|
run: pnpm test
|
||||||
|
timeout-minutes: 15
|
||||||
env:
|
env:
|
||||||
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
|
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
|
||||||
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
|
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
|
||||||
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||||
# - name: Coverage
|
# - name: Coverage
|
||||||
# uses: codecov/codecov-action@v1
|
# uses: codecov/codecov-action@v1
|
||||||
# with:
|
# with:
|
||||||
@@ -50,10 +51,9 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.GH_PAT_CLASSIC }}
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.2.4
|
uses: pnpm/action-setup@v2.2.4
|
||||||
with:
|
|
||||||
version: 7.5.1
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@@ -64,9 +64,10 @@ jobs:
|
|||||||
- name: Publish to npm and GitHub
|
- name: Publish to npm and GitHub
|
||||||
run: pnpm release
|
run: pnpm release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
# Use GH_PAT when this is fixed:
|
||||||
|
# https://github.com/github/roadmap/issues/622
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_CLASSIC }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
NO_VERIFY: 1
|
|
||||||
release-pr:
|
release-pr:
|
||||||
name: Publish PR
|
name: Publish PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -78,8 +79,6 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.2.4
|
uses: pnpm/action-setup@v2.2.4
|
||||||
with:
|
|
||||||
version: 7.5.1
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@@ -110,4 +109,3 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
VERSION: ${{ steps.determine-version.outputs.version }}
|
VERSION: ${{ steps.determine-version.outputs.version }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/sync-examples.yml
vendored
2
.github/workflows/sync-examples.yml
vendored
@@ -14,6 +14,6 @@ jobs:
|
|||||||
# Can update to v1 when https://github.com/BetaHuhn/repo-file-sync-action/issues/168 is resolved
|
# 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
|
uses: BetaHuhn/repo-file-sync-action@v1.16.5
|
||||||
with:
|
with:
|
||||||
GH_PAT: ${{ secrets.SYNC_EXAMPLE_PAT }}
|
GH_PAT: ${{ secrets.GH_PAT_CLASSIC }}
|
||||||
SKIP_PR: true
|
SKIP_PR: true
|
||||||
ORIGINAL_MESSAGE: true
|
ORIGINAL_MESSAGE: true
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
# Misc
|
# Misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.npmrc
|
.npmrc
|
||||||
|
.eslintcache
|
||||||
.env
|
.env
|
||||||
.env.local
|
.env.local
|
||||||
.env.development.local
|
.env.development.local
|
||||||
@@ -86,6 +86,7 @@ packages/core/*.d.ts
|
|||||||
packages/core/*.d.ts.map
|
packages/core/*.d.ts.map
|
||||||
packages/core/lib
|
packages/core/lib
|
||||||
packages/core/providers
|
packages/core/providers
|
||||||
|
packages/core/src/lib/pages/styles.ts
|
||||||
docs/docs/reference/03-core
|
docs/docs/reference/03-core
|
||||||
docs/docs/reference/04-sveltekit
|
docs/docs/reference/04-sveltekit
|
||||||
|
|
||||||
|
|||||||
1
.husky/.gitignore
vendored
1
.husky/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
_
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
|
|
||||||
# npx pretty-quick --staged
|
|
||||||
67
.prettierignore
Normal file
67
.prettierignore
Normal 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
|
||||||
@@ -12,5 +12,11 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
options: { printWidth: 150 },
|
options: { printWidth: 150 },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*package.json"],
|
||||||
|
options: {
|
||||||
|
trailingComma: "none",
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"packages/core/{lib,providers,*.js,*.d.ts,*.d.ts.map}": true,
|
"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
|
"packages/next-auth/{client,core,css,jwt,next,providers,react,utils,*.js,*.d.ts}": true
|
||||||
},
|
},
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"openInGitHub.remote.branch": "main",
|
"openInGitHub.remote.branch": "main"
|
||||||
}
|
}
|
||||||
|
|||||||
12
.vscode/snippets.code-snippets
vendored
12
.vscode/snippets.code-snippets
vendored
@@ -3,16 +3,12 @@
|
|||||||
"description": "Markdown link to OAuth 2 specification",
|
"description": "Markdown link to OAuth 2 specification",
|
||||||
"scope": "typescript",
|
"scope": "typescript",
|
||||||
"prefix": "oauth2",
|
"prefix": "oauth2",
|
||||||
"body": [
|
"body": ["[OAuth 2](https://datatracker.ietf.org/doc/html/rfc6749)"]
|
||||||
"[OAuth 2](https://datatracker.ietf.org/doc/html/rfc6749)"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"oidc-spec": {
|
"oidc-spec": {
|
||||||
"description": "Markdown link to OpenID Connect specification",
|
"description": "Markdown link to OpenID Connect specification",
|
||||||
"scope": "typescript",
|
"scope": "typescript",
|
||||||
"prefix": "oidc",
|
"prefix": "oidc",
|
||||||
"body": [
|
"body": ["[OIDC](https://openid.net/specs/openid-connect-core-1_0.html)"]
|
||||||
"[OIDC](https://openid.net/specs/openid-connect-core-1_0.html)"
|
}
|
||||||
]
|
}
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -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
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
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.
|
||||||
|
|||||||
4
apps/dev/.vscode/settings.json
vendored
4
apps/dev/.vscode/settings.json
vendored
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"typescript.tsdk": "../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/lib",
|
|
||||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
||||||
}
|
|
||||||
@@ -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
4
apps/dev/nextjs/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"typescript.tsdk": "../../../node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib",
|
||||||
|
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||||
|
}
|
||||||
@@ -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:
|
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
|
[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)
|
||||||
12
apps/dev/nextjs/components/layout.js
Normal file
12
apps/dev/nextjs/components/layout.js
Normal 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 />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "next-auth-app",
|
"name": "next-auth-app",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "NextAuth.js Developer app",
|
"description": "Next.js + Auth.js Developer app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf .next",
|
"clean": "rm -rf .next",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"@prisma/client": "^3",
|
"@prisma/client": "^3",
|
||||||
"@supabase/supabase-js": "^2.0.5",
|
"@supabase/supabase-js": "^2.0.5",
|
||||||
"faunadb": "^4",
|
"faunadb": "^4",
|
||||||
"next": "13.0.6",
|
"next": "13.1.1",
|
||||||
"next-auth": "workspace:*",
|
"next-auth": "workspace:*",
|
||||||
"@auth/core": "workspace:*",
|
"@auth/core": "workspace:*",
|
||||||
"nodemailer": "^6",
|
"nodemailer": "^6",
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
import Layout from '../components/layout'
|
import Layout from "../components/layout"
|
||||||
|
|
||||||
export default function Page () {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<h1>API Example</h1>
|
<h1>API Example</h1>
|
||||||
<p>The examples below show responses from the example API endpoints.</p>
|
<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>
|
<h2>Session</h2>
|
||||||
<p>/api/examples/session</p>
|
<p>/api/examples/session</p>
|
||||||
<iframe src='/api/examples/session' />
|
<iframe src="/api/examples/session" />
|
||||||
<h2>JSON Web Token</h2>
|
<h2>JSON Web Token</h2>
|
||||||
<p>/api/examples/jwt</p>
|
<p>/api/examples/jwt</p>
|
||||||
<iframe src='/api/examples/jwt' />
|
<iframe src="/api/examples/jwt" />
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
27
apps/dev/nextjs/pages/client.js
Normal file
27
apps/dev/nextjs/pages/client.js
Normal 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></Header></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>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import Layout from 'components/layout'
|
import Layout from "components/layout"
|
||||||
|
|
||||||
export default function Page () {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<h1>NextAuth.js Example</h1>
|
<h1>NextAuth.js Example</h1>
|
||||||
<p>
|
<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.
|
<a href="https://authjs.dev">NextAuth.js</a> for authentication.
|
||||||
</p>
|
</p>
|
||||||
</Layout>
|
</Layout>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { unstable_getServerSession } from "next-auth/next"
|
import { unstable_getServerSession } from "next-auth/next"
|
||||||
import Layout from "../components/layout"
|
import Layout from "../components/layout"
|
||||||
import { authOptions } from './api/auth/[...nextauth]';
|
import { authOptions } from "./api/auth/[...nextauth]"
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
// As this page uses Server Side Rendering, the `session` will be already
|
// As this page uses Server Side Rendering, the `session` will be already
|
||||||
@@ -27,6 +27,6 @@ iframe {
|
|||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
height: 10rem;
|
height: 10rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: .5rem;
|
border-radius: 0.5rem;
|
||||||
filter: invert(1);
|
filter: invert(1);
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
@@ -25,14 +21,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"next-env.d.ts",
|
"exclude": ["node_modules", "jest.config.js"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
".next/types/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"jest.config.js"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@@ -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></Header></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>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"name": "sveltekit-auth-app",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "SvelteKit + Auth.js Developer app",
|
||||||
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import SvelteKitAuth from "@auth/sveltekit"
|
import { SvelteKitAuth } from "@auth/sveltekit"
|
||||||
import GitHub from "@auth/core/providers/github"
|
import GitHub from "@auth/core/providers/github"
|
||||||
import { GITHUB_ID, GITHUB_SECRET } from "$env/static/private"
|
import { GITHUB_ID, GITHUB_SECRET } from "$env/static/private"
|
||||||
|
|
||||||
@@ -2,9 +2,18 @@
|
|||||||
import { page } from "$app/stores"
|
import { page } from "$app/stores"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if $page.data.session}
|
||||||
<h1>Protected page</h1>
|
<h1>Protected page</h1>
|
||||||
<p>
|
<p>
|
||||||
This is a protected content. You can access this content because you are
|
This is a protected content. You can access this content because you are
|
||||||
signed in.
|
signed in.
|
||||||
</p>
|
</p>
|
||||||
<p>Session expiry: {$page.data.session?.expires}</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}
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
5
apps/example-nextjs/next-env.d.ts
vendored
5
apps/example-nextjs/next-env.d.ts
vendored
@@ -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.
|
|
||||||
@@ -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 {}
|
|
||||||
}
|
|
||||||
@@ -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.
|
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
|
## 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:
|
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
|
### 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}`.
|
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.
|
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
|
## License
|
||||||
|
|
||||||
ISC
|
ISC
|
||||||
|
|
||||||
@@ -11,4 +11,4 @@
|
|||||||
.navItem {
|
.navItem {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
@@ -11,10 +11,10 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 0 0 .6rem .6rem;
|
border-radius: 0 0 0.6rem 0.6rem;
|
||||||
padding: .6rem 1rem;
|
padding: 0.6rem 1rem;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: rgba(0,0,0,.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
transition: all 0.2s ease-in;
|
transition: all 0.2s ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,13 +26,13 @@
|
|||||||
.signedInText,
|
.signedInText,
|
||||||
.notSignedInText {
|
.notSignedInText {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
padding-top: .8rem;
|
padding-top: 0.8rem;
|
||||||
left: 1rem;
|
left: 1rem;
|
||||||
right: 6.5rem;
|
right: 6.5rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: inherit;
|
display: inherit;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
line-height: 1.3rem;
|
line-height: 1.3rem;
|
||||||
}
|
}
|
||||||
@@ -55,13 +55,13 @@
|
|||||||
.button,
|
.button,
|
||||||
.buttonPrimary {
|
.buttonPrimary {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: -.4rem;
|
margin-right: -0.4rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border-radius: .3rem;
|
border-radius: 0.3rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.4rem;
|
line-height: 1.4rem;
|
||||||
padding: .7rem .8rem;
|
padding: 0.7rem 0.8rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
@@ -73,11 +73,11 @@
|
|||||||
border-color: #346df1;
|
border-color: #346df1;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: .7rem 1.4rem;
|
padding: 0.7rem 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttonPrimary:hover {
|
.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 {
|
.navItems {
|
||||||
@@ -89,4 +89,4 @@
|
|||||||
.navItem {
|
.navItem {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user