Compare commits

..

80 Commits

Author SHA1 Message Date
GitHub Actions
3245c02eac chore(release): bump package version(s) [skip ci] 2023-06-27 15:22:02 +00:00
Doron Sharon
a8dfc8ebb1 feat(providers): Add Descope provider (#7874)
* Add Descope provider

* Add Descope provider

* Remove dark logo, remove wellKnown, and fix user profile syntax

* Change to DESCOPE_SECRET

* Fix env comment

* Fix clientId extracting

* Change to client id
2023-06-26 18:18:58 +02:00
Esteve
1b80a18dd4 fix(adapters): Add .js file extension to relative imports (#7856)
Add .js file extension to relative imports
2023-06-24 10:21:50 +02:00
GitHub Actions
50a88bb878 chore(release): bump package version(s) [skip ci] 2023-06-22 12:50:36 +00:00
Balázs Orbán
a359a562ce fix: correctly assert protocol 2023-06-22 14:27:44 +02:00
GitHub Actions
7edb9cf53f chore(release): bump package version(s) [skip ci] 2023-06-21 07:57:50 +00:00
Balázs Orbán
018b086c4f chore: fix tests 2023-06-21 09:42:46 +02:00
Balázs Orbán
173000a068 fix: add .js extension
fixes #7826
2023-06-21 09:14:03 +02:00
Balázs Orbán
8fcd46b0fc fix(ts): loosen Profile type 2023-06-20 17:15:22 +02:00
GitHub Actions
d5d1313914 chore(release): bump package version(s) [skip ci] 2023-06-14 13:07:32 +00:00
Balázs Orbán
3285d04241 fix(build): use correct tsconfig 2023-06-14 14:51:50 +02:00
Balázs Orbán
fe442522ef fix(client): remove unused declaration 2023-06-14 14:48:22 +02:00
GitHub Actions
6c9dfff45f chore(release): bump package version(s) [skip ci] 2023-06-14 12:47:31 +00:00
Balázs Orbán
ef50916ec2 fix(ts): correct user type reference 2023-06-14 14:37:34 +02:00
GitHub Actions
8e771a2993 chore(release): bump package version(s) [skip ci] 2023-06-14 12:22:38 +00:00
Balázs Orbán
06a7149b66 feat: introduce @auth/supabase-adapter (#7807)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/supabase-adapter": "0.0.0",
+  "@auth/supabase-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-14 13:09:29 +01:00
Balázs Orbán
662e0942cb feat: introduce @auth/xata-adapter (#7808)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/xata-adapter": "0.0.0",
+  "@auth/xata-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-14 13:09:14 +01:00
Balázs Orbán
91c71a175b chore: fix version 2023-06-14 14:08:13 +02:00
Balázs Orbán
3b8c75297b fix: use correct import 2023-06-14 13:50:30 +02:00
Balázs Orbán
5d06fa5852 feat: introduce @auth/sequelize-adapter (#7806)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/sequelize-adapter": "0.0.0",
+  "@auth/sequelize-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-14 12:38:15 +01:00
Balázs Orbán
e7a52077c5 feat: introduce @auth/pouchdb-adapter (#7805)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/pouchdb-adapter": "0.0.0",
+  "@auth/pouchdb-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only

This package assumes that `globalThis.crypto` is available.

In older Node.js versions, you can polyfill by adding:

`globalThis.crypto ??= require("node:crypto").webcrypto`
2023-06-14 12:28:39 +01:00
Balázs Orbán
6e4516a9f8 feat: introduce @auth/neo4j-adapter (#7804)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/neo4j-adapter": "0.0.0",
+  "@auth/neo4j-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only

This package assumes that `globalThis.crypto` is available.

In older Node.js versions, you can polyfill by adding:

`globalThis.crypto ??= require("node:crypto").webcrypto`
2023-06-14 12:26:38 +01:00
Balázs Orbán
8a0b11fcd6 chore: reset version 2023-06-14 12:03:07 +01:00
Balázs Orbán
f925e0c2a5 feat: introduce @auth/firebase-adapter (#7803)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/firebase-adapter": "0.0.0",
+  "@auth/firebase-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-14 12:02:24 +01:00
Balázs Orbán
de4e20cc04 feat: introduce @auth/fauna-adapter (#7802)
* feat: introduce `@auth/fauna-adapter`

Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/fauna-adapter": "0.0.0",
+  "@auth/fauna-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-14 12:00:40 +01:00
GitHub Actions
65f4b9c942 chore(release): bump package version(s) [skip ci] 2023-06-13 15:02:46 +00:00
Balázs Orbán
1d29b0d220 feat: introduce @auth/mikro-orm-adapter (#7794)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/mikro-orm-adapter": "0.0.0",
+  "@auth/mikro-orm-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only

This package assumes that `globalThis.crypto` is available.

In older Node.js versions, you can polyfill by adding:

`globalThis.crypto ??= require("node:crypto").webcrypto`
2023-06-13 15:39:43 +01:00
Balázs Orbán
cd92aa0c82 feat: introduce @auth/dynamodb-adapter (#7793)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/dynamodb-adapter": "0.0.0",
+  "@auth/dynamodb-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only

This package assumes that `globalThis.crypto` is available.

In older Node.js versions, you can polyfill by adding:

`globalThis.crypto ??= require("node:crypto").webcrypto`
2023-06-13 15:28:33 +01:00
Balázs Orbán
d414e01181 feat: introduce @auth/dgraph-adapter (#7792)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.
    
BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/dgraph-adapter": "0.0.0",
+  "@auth/dgraph-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only

`fetch` is not polyfilled anymore.

In older Node.js versions, you can use the  `--experimental-fetch` flag, or install `undici` and add the following line:

`globalThis.fetch ??= require("undici").fetch`
2023-06-13 14:31:04 +01:00
GitHub Actions
43deda5bfb chore(release): bump package version(s) [skip ci] 2023-06-13 12:49:24 +00:00
Balázs Orbán
7e79d8c509 feat: introduce @auth/upstash-redis-adapter (#7791)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/upstash-redis-adapter": "0.0.0",
+  "@auth/upstash-redis-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only

This package assumes that `globalThis.crypto` is available.

In older Node.js versions, you can polyfill by adding:

`globalThis.crypto ??= require("node:crypto").webcrypto`
2023-06-13 14:36:38 +02:00
Balázs Orbán
ab051162a7 chore: reset @auth/mongodb-adapter version 2023-06-13 13:02:19 +01:00
Balázs Orbán
87298a0150 feat: introduce @auth/mongodb-adapter (#7790)
Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/mongodb-adapter": "0.0.0",
+  "@auth/mongodb-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-13 13:41:12 +02:00
GitHub Actions
d6abccd9a0 chore(release): bump package version(s) [skip ci] 2023-06-13 11:37:54 +00:00
Josua Frank
2f35daae37 fix(client): respect { redirect: true } in signIn() (#7775)
* Fix `signIn()` not respecting `{ redirect: true }`

* Apply suggestions from code review

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2023-06-13 12:14:49 +01:00
Koen Bolhuis
a0f3b04c43 docs: Fix typo in email tutorial (#7769) 2023-06-13 12:11:04 +01:00
GitHub Actions
c7dec376a1 chore(release): bump package version(s) [skip ci] 2023-06-05 21:41:46 +00:00
Gage Keenan
925a52e0ec fix: sort chunked session cookies (#7736)
Update cookie.ts
2023-06-05 17:36:10 +01:00
Imamuzzaki Abu Salam
2318e44de4 docs(cypress): update file config to latest cypress c… (#7733)
docs(testing-with-cypress.md): update file config to latest cypress config filename
2023-06-05 17:33:37 +01:00
GitHub Actions
d73812bce5 chore(release): bump package version(s) [skip ci] 2023-06-01 17:21:47 +00:00
Balázs Orbán
ee36d09a08 chore: drop Legacy from naming everywhere 2023-06-01 19:05:44 +02:00
Balázs Orbán
0cb7fd2e7c feat: introduce @auth/typeorm-adapter (#7706)
BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/typeorm-legacy-adapter": "0.0.0",
+  "@auth/typeorm-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
2023-06-01 17:52:11 +01:00
GitHub Actions
3b414bd7b5 chore(release): bump package version(s) [skip ci] 2023-06-01 14:19:07 +00:00
Balázs Orbán
37bb6ebd2c fix(docs): update code example 2023-06-01 16:08:21 +02:00
Balázs Orbán
2ecf52c342 feat: introduce @auth/prisma-adapter (#7703)
BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/prisma-adapter": "0.0.0",
+  "@auth/prisma-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only.
2023-06-01 16:06:22 +02:00
Balázs Orbán
cda07c239e chore: remove "nuxt postinstall" 2023-06-01 15:17:58 +02:00
Balázs Orbán
fa60b79abe chore: upgrade turbo 2023-06-01 15:15:23 +02:00
GitHub Actions
39e1a76e8f chore(release): bump package version(s) [skip ci] 2023-06-01 12:59:53 +00:00
Balázs Orbán
953ef9d04a chore: re-add pnpm caching
Related: #7332
2023-06-01 14:49:45 +02:00
Balázs Orbán
94f3031765 chore: allow manual release of any @auth/* package 2023-06-01 14:49:45 +02:00
Balázs Orbán
ad7bf07ddf chore: update lock file 2023-06-01 14:49:45 +02:00
Graham Charles
f30308ac30 docs: fix info card rendering in oauth-tutorial.mdx (#7662)
Info box is not being rendered; the raw `:::info` is displayed. Blind guess: it needs a blank line before it.
2023-06-01 14:49:45 +02:00
Tashrik Anam
6eaaeb15e9 docs: adapter card text color on hover when on dark mode (#7672) 2023-06-01 14:49:45 +02:00
Robert Soriano
8b3f0696a5 chore(playgrounds): Nuxt 3.5.1 (#7626)
* bump Nuxt to 3.5.1

* follow playground package names

* chore: update nuxt playground scripts

* fix: imports and types

* fix: more nuxt type imports

* fix: nuxt auth options types

* fix: nuxt client fetch types
2023-06-01 14:49:45 +02:00
Doron Sharon
c69a157832 chore: Add Descope as a 🥉 bronze financial sponsor (#7615)
Add Descope as a bronze sponsor
2023-06-01 14:49:45 +02:00
TATHAGATA ROY
60af446338 docs: Cypress.Cookies.defaults removed (#7574) 2023-06-01 14:49:45 +02:00
Nirmalya Ghosh
ce85444760 chore: Move next.config.js file into the correct directory (#7580)
fix: moves next config file into the correct directory
2023-06-01 14:49:45 +02:00
Balázs Orbán
142abe3eea feat: allow empty account mapper 2023-06-01 14:49:45 +02:00
Balázs Orbán
da211e6cbe chore: revert picture to image 2023-06-01 14:49:45 +02:00
Balázs Orbán
79ad6156ed feat: add update session to core (#7505)
* feat: add update session to core

Integrates #7056 into `@auth/core`

* resolve default user after jwt callback
2023-06-01 14:49:45 +02:00
Rémi Robichet
28f287d63e docs(example): update broken link (#7504)
Co-authored-by: Nico Domino <yo@ndo.dev>
2023-06-01 14:49:45 +02:00
Balázs Orbán
1ab77d0e11 chore: move build to root 2023-06-01 14:49:45 +02:00
Balázs Orbán
787c1ff7d0 chore: add build to manual publish 2023-06-01 14:49:45 +02:00
Balázs Orbán
208b3b4a43 chore: reduce breaking changes on Account mapping
Reverts some changes on #7369 so DB migration won't be needed
2023-06-01 14:49:45 +02:00
Balázs Orbán
c4f6330f70 chore: tweak manual release version 2023-06-01 14:49:45 +02:00
Balázs Orbán
44127068e1 chore: tweaks 2023-06-01 14:49:45 +02:00
Balázs Orbán
9e3f1aacf7 chore: tweak 2023-06-01 14:49:45 +02:00
Balázs Orbán
83051c6862 chore: skip test for manual release 2023-06-01 14:49:45 +02:00
Balázs Orbán
f1acab67e6 chore: separate manual release job 2023-06-01 14:49:45 +02:00
Balázs Orbán
6a31ed3216 chore: support release any package as experimental 2023-06-01 14:49:45 +02:00
Balázs Orbán
0998fc0b98 chore: use @ts-ignore 2023-06-01 14:49:45 +02:00
Balázs Orbán
bd20d750c2 fix(docs): remove extra heading
Fixes #7426
2023-06-01 14:49:45 +02:00
Balázs Orbán
8e29b4df0c fix: allow handling OAuth callback error response
related #7407
2023-06-01 14:49:45 +02:00
Balázs Orbán
9632a56d45 chore: type fixes 2023-06-01 14:49:45 +02:00
Balázs Orbán
12161b9613 fix: loosen profile types 2023-06-01 14:49:45 +02:00
Balázs Orbán
a3b5276a5a chore: improve errors, add more docs (#7415)
* JWT Token -> JWT

* document some errors

* improve errors, docs
2023-06-01 14:49:45 +02:00
Balázs Orbán
7c1078b9a9 feat(adapters): add Account mapping before database write (#7369)
* feat: map Account before saving to database

* document `acconut()`, explain default behaviour

* generate `expires_at` based on `expires_in`

Fixes #6538

* rename

* strip undefined on `defaultProfile`

* don't forward defaults to account callback

* improve internal namings, types, docs
2023-06-01 14:49:45 +02:00
Victor
37d3461155 docs: fix default maxAge formula (#7406) 2023-06-01 14:49:40 +02:00
Balázs Orbán
6111662df7 docs: Update creating-a-database-adapter.md 2023-04-30 09:52:47 +02:00
Zack Reneau-Wedeen
5da6549c48 chore(docs): update xata docs link (#7397)
Update link to a working page (Workspaces API reference)

Co-authored-by: Nico Domino <yo@ndo.dev>
2023-04-28 22:26:30 +02:00
166 changed files with 5863 additions and 2511 deletions

View File

@@ -37,6 +37,7 @@ body:
- "Bungie"
- "Cognito"
- "Coinbase"
- "Descope"
- "Discord"
- "Dropbox"
- "EVE Online"

View File

@@ -21,20 +21,20 @@ body:
multiple: true
options:
- "Custom adapter"
- "@next-auth/dgraph-adapter"
- "@next-auth/dynamodb-adapter"
- "@next-auth/fauna-adapter"
- "@next-auth/firebase-adapter"
- "@next-auth/mikro-orm-adapter"
- "@next-auth/mongodb-adapter"
- "@next-auth/neo4j-adapter"
- "@next-auth/pouchdb-adapter"
- "@next-auth/prisma-adapter"
- "@next-auth/sequelize-adapter"
- "@next-auth/supabase-adapter"
- "@next-auth/typeorm-legacy-adapter"
- "@next-auth/upstash-redis-adapter"
- "@next-auth/xata-adapter"
- "@auth/dgraph-adapter"
- "@auth/dynamodb-adapter"
- "@auth/fauna-adapter"
- "@auth/firebase-adapter"
- "@auth/mikro-orm-adapter"
- "@auth/mongodb-adapter"
- "@auth/neo4j-adapter"
- "@auth/pouchdb-adapter"
- "@auth/prisma-adapter"
- "@auth/sequelize-adapter"
- "@auth/supabase-adapter"
- "@auth/typeorm-adapter"
- "@auth/upstash-redis-adapter"
- "@auth/xata-adapter"
validations:
required: true
- type: textarea

View File

@@ -1,43 +1,43 @@
# https://github.com/github/issue-labeler#basic-examples
dgraph:
- "@next-auth/dgraph-adapter"
- "@auth/dgraph-adapter"
dynamodb:
- "@next-auth/dynamodb-adapter"
- "@auth/dynamodb-adapter"
fauna:
- "@next-auth/fauna-adapter"
- "@auth/fauna-adapter"
firebase:
- "@next-auth/firebase-adapter"
- "@auth/firebase-adapter"
mikro-orm:
- "@next-auth/mikro-orm-adapter"
- "@auth/mikro-orm-adapter"
mongodb:
- "@next-auth/mongodb-adapter"
- "@auth/mongodb-adapter"
neo4j:
- "@next-auth/neo4j-adapter"
- "@auth/neo4j-adapter"
pouchdb:
- "@next-auth/pouchdb-adapter"
- "@auth/pouchdb-adapter"
prisma:
- "@next-auth/prisma-adapter"
- "@auth/prisma-adapter"
sequelize:
- "@next-auth/sequelize-adapter"
- "@auth/sequelize-adapter"
supabase:
- "@next-auth/supabase-adapter"
- "@auth/supabase-adapter"
typeorm-legacy:
- "@next-auth/typeorm-legacy-adapter"
typeorm:
- "@auth/typeorm-adapter"
upstash-redis:
- "@next-auth/upstash-redis-adapter"
- "@auth/upstash-redis-adapter"
xata:
- "@next-auth/xata-adapter"
- "@auth/xata-adapter"

View File

@@ -21,6 +21,6 @@ solidjs: ["packages/frameworks-solid-start/**/*"]
supabase: ["packages/adapter-supabase/**/*"]
svelte: ["packages/frameworks-sveltekit/**/*"]
test: ["**test**/*"]
typeorm-legacy: ["packages/adapter-typeorm-legacy/**/*"]
typeorm: ["packages/adapter-typeorm/**/*"]
upstash-redis: ["packages/adapter-upstash-redis/**/*"]
xata: ["packages/adapter-xata/**/*"]

View File

@@ -5,14 +5,15 @@ const core = require("@actions/core")
try {
const packageJSONPath = path.join(
process.cwd(),
"packages/next-auth/package.json"
`packages/${process.env.PACKAGE_PATH || "next-auth"}/package.json`
)
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf8"))
const sha8 = process.env.GITHUB_SHA.substring(0, 8)
const prNumber = process.env.PR_NUMBER
const packageVersion = `0.0.0-pr.${prNumber}.${sha8}`
const prefix = "0.0.0-"
const pr = process.env.PR_NUMBER
const source = pr ? `pr.${pr}` : "manual"
const packageVersion = `${prefix}${source}.${sha8}`
packageJSON.version = packageVersion
core.setOutput("version", packageVersion)
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON))

View File

@@ -8,6 +8,54 @@ on:
- next
- 3.x
pull_request:
# TODO: Support latest releases
workflow_dispatch:
inputs:
name:
type: choice
description: Package name (npm)
options:
- "@auth/core"
- "@auth/nextjs"
- "@auth/dgraph-adapter"
- "@auth/drizzle-adapter"
- "@auth/dynamodb-adapter"
- "@auth/fauna-adapter"
- "@auth/firebase-adapter"
- "@auth/mikro-orm-adapter"
- "@auth/mongodb-adapter"
- "@auth/neo4j-adapter"
- "@auth/pouchdb-adapter"
- "@auth/prisma-adapter"
- "@auth/sequelize-adapter"
- "@auth/supabase-adapter"
- "@auth/typeorm-adapter"
- "@auth/upstash-redis-adapter"
- "@auth/xata-adapter"
- "next-auth"
# TODO: Infer from package name
path:
type: choice
description: Directory name (packages/*)
options:
- "core"
- "frameworks-nextjs"
- "adapter-dgraph"
- "adapter-drizzle"
- "adapter-dynamodb"
- "adapter-fauna"
- "adapter-firebase"
- "adapter-mikro-orm"
- "adapter-mongodb"
- "adapter-neo4j"
- "adapter-pouchdb"
- "adapter-prisma"
- "adapter-sequelize"
- "adapter-supabase"
- "adapter-typeorm"
- "adapter-upstash-redis"
- "adapter-xata"
- "next-auth"
jobs:
test:
@@ -24,6 +72,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run tests
@@ -73,6 +122,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Publish to npm and GitHub
@@ -97,6 +147,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Determine version
@@ -122,3 +173,36 @@ jobs:
env:
VERSION: ${{ steps.determine-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
release-manual:
name: Publish manually
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Init
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Determine version
uses: ./.github/version-pr
id: determine-version
env:
PACKAGE_PATH: ${{ github.event.inputs.path }}
- name: Publish to npm
run: |
pnpm build
cd packages/$PACKAGE_PATH
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
pnpm publish --no-git-checks --access public --tag experimental
echo "🎉 Experimental release published 📦️ on npm: https://npmjs.com/package/${{ github.event.inputs.name }}/v/${{ env.VERSION }}"
echo "Install via: pnpm add ${{ github.event.inputs.name }}@${{ env.VERSION }}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PACKAGE_PATH: ${{ github.event.inputs.path }}
VERSION: ${{ steps.determine-version.outputs.version }}

1
.gitignore vendored
View File

@@ -38,6 +38,7 @@ packages/next-auth/next
packages/*/*.js
packages/*/*.d.ts
packages/*/*.d.ts.map
packages/*/lib
# Development app
apps/dev/src/css

View File

@@ -13,6 +13,9 @@ AUTH0_ID=
AUTH0_SECRET=
AUTH0_ISSUER=
DESCOPE_ID=
DESCOPE_SECRET=
KEYCLOAK_ID=
KEYCLOAK_SECRET=
KEYCLOAK_ISSUER=

View File

@@ -14,10 +14,10 @@
},
"license": "ISC",
"dependencies": {
"@next-auth/fauna-adapter": "workspace:*",
"@next-auth/prisma-adapter": "workspace:*",
"@next-auth/supabase-adapter": "workspace:*",
"@next-auth/typeorm-legacy-adapter": "workspace:*",
"@auth/fauna-adapter": "workspace:*",
"@auth/prisma-adapter": "workspace:*",
"@auth/supabase-adapter": "workspace:*",
"@auth/typeorm-adapter": "workspace:*",
"@prisma/client": "^3",
"@supabase/supabase-js": "^2.0.5",
"faunadb": "^4",

View File

@@ -37,22 +37,22 @@ import WorkOS from "next-auth/providers/workos"
// // Prisma
// import { PrismaClient } from "@prisma/client"
// import { PrismaAdapter } from "@next-auth/prisma-adapter"
// import { PrismaAdapter } from "@auth/prisma-adapter"
// const client = globalThis.prisma || new PrismaClient()
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client
// const adapter = PrismaAdapter(client)
// // Fauna
// import { Client as FaunaClient } from "faunadb"
// import { FaunaAdapter } from "@next-auth/fauna-adapter"
// import { FaunaAdapter } from "@auth/fauna-adapter"
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
// const client = globalThis.fauna || new FaunaClient(opts)
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
// const adapter = FaunaAdapter(client)
// // TypeORM
// import { TypeORMLegacyAdapter } from "@next-auth/typeorm-legacy-adapter"
// const adapter = TypeORMLegacyAdapter({
// import { TypeORMAdapter } from "@auth/typeorm-adapter"
// const adapter = TypeORMAdapter({
// type: "sqlite",
// name: "next-auth-test-memory",
// database: "./typeorm/dev.db",
@@ -60,7 +60,7 @@ import WorkOS from "next-auth/providers/workos"
// })
// // Supabase
// import { SupabaseAdapter } from "@next-auth/supabase-adapter"
// import { SupabaseAdapter } from "@auth/supabase-adapter"
// const adapter = SupabaseAdapter({
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
@@ -78,45 +78,130 @@ export const authOptions: NextAuthOptions = {
credentials: { password: { label: "Password", type: "password" } },
async authorize(credentials) {
if (credentials.password !== "pw") return null
return { name: "Fill Murray", email: "bill@fillmurray.com", image: "https://www.fillmurray.com/64/64", id: "1", foo: "" }
return {
name: "Fill Murray",
email: "bill@fillmurray.com",
image: "https://www.fillmurray.com/64/64",
id: "1",
foo: "",
}
},
}),
Apple({ clientId: process.env.APPLE_ID, clientSecret: process.env.APPLE_SECRET }),
Auth0({ clientId: process.env.AUTH0_ID, clientSecret: process.env.AUTH0_SECRET, issuer: process.env.AUTH0_ISSUER }),
Apple({
clientId: process.env.APPLE_ID,
clientSecret: process.env.APPLE_SECRET,
}),
Auth0({
clientId: process.env.AUTH0_ID,
clientSecret: process.env.AUTH0_SECRET,
issuer: process.env.AUTH0_ISSUER,
}),
AzureAD({
clientId: process.env.AZURE_AD_CLIENT_ID,
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
tenantId: process.env.AZURE_AD_TENANT_ID,
}),
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
AzureB2C({
clientId: process.env.AZURE_B2C_ID,
clientSecret: process.env.AZURE_B2C_SECRET,
issuer: process.env.AZURE_B2C_ISSUER,
}),
BoxyHQSAML({
issuer: "https://jackson-demo.boxyhq.com",
clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com",
clientSecret: "dummy",
}),
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
DuendeIDS6({ clientId: "interactive.confidential", clientSecret: "secret", issuer: "https://demo.duendesoftware.com" }),
Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }),
Foursquare({ clientId: process.env.FOURSQUARE_ID, clientSecret: process.env.FOURSQUARE_SECRET }),
Freshbooks({ clientId: process.env.FRESHBOOKS_ID, clientSecret: process.env.FRESHBOOKS_SECRET }),
GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET }),
Gitlab({ clientId: process.env.GITLAB_ID, clientSecret: process.env.GITLAB_SECRET }),
Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET }),
Discord({
clientId: process.env.DISCORD_ID,
clientSecret: process.env.DISCORD_SECRET,
}),
DuendeIDS6({
clientId: "interactive.confidential",
clientSecret: "secret",
issuer: "https://demo.duendesoftware.com",
}),
Facebook({
clientId: process.env.FACEBOOK_ID,
clientSecret: process.env.FACEBOOK_SECRET,
}),
Foursquare({
clientId: process.env.FOURSQUARE_ID,
clientSecret: process.env.FOURSQUARE_SECRET,
}),
Freshbooks({
clientId: process.env.FRESHBOOKS_ID,
clientSecret: process.env.FRESHBOOKS_SECRET,
}),
GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
Gitlab({
clientId: process.env.GITLAB_ID,
clientSecret: process.env.GITLAB_SECRET,
}),
Google({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
// IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
Instagram({ clientId: process.env.INSTAGRAM_ID, clientSecret: process.env.INSTAGRAM_SECRET }),
Instagram({
clientId: process.env.INSTAGRAM_ID,
clientSecret: process.env.INSTAGRAM_SECRET,
}),
// Keycloak({ clientId: process.env.KEYCLOAK_ID, clientSecret: process.env.KEYCLOAK_SECRET, issuer: process.env.KEYCLOAK_ISSUER }),
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 }),
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,
}),
// 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 }),
Slack({ clientId: process.env.SLACK_ID, clientSecret: process.env.SLACK_SECRET }),
Spotify({ clientId: process.env.SPOTIFY_ID, clientSecret: process.env.SPOTIFY_SECRET }),
Trakt({ clientId: process.env.TRAKT_ID, clientSecret: process.env.TRAKT_SECRET }),
Twitch({ clientId: process.env.TWITCH_ID, clientSecret: process.env.TWITCH_SECRET }),
Twitter({ clientId: process.env.TWITTER_ID, clientSecret: process.env.TWITTER_SECRET }),
Osu({
clientId: process.env.OSU_CLIENT_ID,
clientSecret: process.env.OSU_CLIENT_SECRET,
}),
Patreon({
clientId: process.env.PATREON_ID,
clientSecret: process.env.PATREON_SECRET,
}),
Slack({
clientId: process.env.SLACK_ID,
clientSecret: process.env.SLACK_SECRET,
}),
Spotify({
clientId: process.env.SPOTIFY_ID,
clientSecret: process.env.SPOTIFY_SECRET,
}),
Trakt({
clientId: process.env.TRAKT_ID,
clientSecret: process.env.TRAKT_SECRET,
}),
Twitch({
clientId: process.env.TWITCH_ID,
clientSecret: process.env.TWITCH_SECRET,
}),
Twitter({
clientId: process.env.TWITTER_ID,
clientSecret: process.env.TWITTER_SECRET,
}),
// TwitterLegacy({ clientId: process.env.TWITTER_LEGACY_ID, clientSecret: process.env.TWITTER_LEGACY_SECRET }),
Vk({ clientId: process.env.VK_ID, clientSecret: process.env.VK_SECRET }),
Wikimedia({ clientId: process.env.WIKIMEDIA_ID, clientSecret: process.env.WIKIMEDIA_SECRET }),
WorkOS({ clientId: process.env.WORKOS_ID, clientSecret: process.env.WORKOS_SECRET }),
Wikimedia({
clientId: process.env.WIKIMEDIA_ID,
clientSecret: process.env.WIKIMEDIA_SECRET,
}),
WorkOS({
clientId: process.env.WORKOS_ID,
clientSecret: process.env.WORKOS_SECRET,
}),
],
}

View File

@@ -22,6 +22,9 @@ BEYOND_IDENTITY_CLIENT_ID=
BEYOND_IDENTITY_CLIENT_SECRET=
BEYOND_IDENTITY_ISSUER=
DESCOPE_ID=
DESCOPE_SECRET=
GITHUB_ID=
GITHUB_SECRET=

View File

@@ -15,10 +15,10 @@
"license": "ISC",
"dependencies": {
"@auth/core": "workspace:*",
"@next-auth/fauna-adapter": "workspace:*",
"@next-auth/prisma-adapter": "workspace:*",
"@next-auth/supabase-adapter": "workspace:*",
"@next-auth/typeorm-legacy-adapter": "workspace:*",
"@auth/fauna-adapter": "workspace:*",
"@auth/prisma-adapter": "workspace:*",
"@auth/supabase-adapter": "workspace:*",
"@auth/typeorm-adapter": "workspace:*",
"@prisma/client": "^3",
"@supabase/supabase-js": "^2.0.5",
"faunadb": "^4",

View File

@@ -10,6 +10,7 @@ import BeyondIdentity from "@auth/core/providers/beyondidentity"
import BoxyHQSAML from "@auth/core/providers/boxyhq-saml"
// import Cognito from "@auth/core/providers/cognito"
import Credentials from "@auth/core/providers/credentials"
import Descope from "@auth/core/providers/descope"
import Discord from "@auth/core/providers/discord"
import DuendeIDS6 from "@auth/core/providers/duende-identity-server6"
// import Email from "@auth/core/providers/email"
@@ -41,22 +42,22 @@ import WorkOS from "@auth/core/providers/workos"
// // Prisma
// import { PrismaClient } from "@prisma/client"
// import { PrismaAdapter } from "@next-auth/prisma-adapter"
// import { PrismaAdapter } from "@auth/prisma-adapter"
// const client = globalThis.prisma || new PrismaClient()
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client
// const adapter = PrismaAdapter(client)
// // Fauna
// import { Client as FaunaClient } from "faunadb"
// import { FaunaAdapter } from "@next-auth/fauna-adapter"
// import { FaunaAdapter } from "@auth/fauna-adapter"
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
// const client = globalThis.fauna || new FaunaClient(opts)
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
// const adapter = FaunaAdapter(client)
// // TypeORM
// import { TypeORMLegacyAdapter } from "@next-auth/typeorm-legacy-adapter"
// const adapter = TypeORMLegacyAdapter({
// import { TypeORMAdapter } from "@auth/typeorm-adapter"
// const adapter = TypeORMAdapter({
// type: "sqlite",
// name: "next-auth-test-memory",
// database: "./typeorm/dev.db",
@@ -64,7 +65,7 @@ import WorkOS from "@auth/core/providers/workos"
// })
// // Supabase
// import { SupabaseAdapter } from "@next-auth/supabase-adapter"
// import { SupabaseAdapter } from "@auth/supabase-adapter"
// const adapter = SupabaseAdapter({
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
@@ -94,9 +95,14 @@ export const authConfig: AuthConfig = {
tenantId: process.env.AZURE_AD_TENANT_ID,
}),
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
BeyondIdentity({ clientId: process.env.BEYOND_IDENTITY_CLIENT_ID, clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET, issuer: process.env.BEYOND_IDENTITY_ISSUER }),
BeyondIdentity({
clientId: process.env.BEYOND_IDENTITY_CLIENT_ID,
clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET,
issuer: process.env.BEYOND_IDENTITY_ISSUER,
}),
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
Descope({ clientId: process.env.DESCOPE_ID, clientSecret: process.env.DESCOPE_SECRET }),
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
DuendeIDS6({ clientId: "interactive.confidential", clientSecret: "secret", issuer: "https://demo.duendesoftware.com" }),
Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }),

View File

@@ -6,6 +6,9 @@ AUTH0_ID=
AUTH0_SECRET=
AUTH0_ISSUER=
DESCOPE_ID=
DESCOPE_SECRET=
FACEBOOK_ID=
FACEBOOK_SECRET=

View File

@@ -7,7 +7,7 @@ export default function Page() {
<p>Only admin users can see this page.</p>
<p>
To learn more about the NextAuth middleware see&nbsp;
<a href="https://docs-git-misc-docs-nextauthjs.vercel.app/configuration/nextjs#middleware">
<a href="https://next-auth.js.org/configuration/nextjs#middleware">
the docs
</a>
.

View File

@@ -12,5 +12,7 @@ declare namespace NodeJS {
GOOGLE_SECRET: string
AUTH0_ID: string
AUTH0_SECRET: string
DESCOPE_ID: string
DESCOPE_SECRET: string
}
}

View File

@@ -1,4 +1,4 @@
import { Session } from "@auth/core"
import { Session } from "@auth/core/types"
export default function useSession() {
return useState<Session | null>("session", () => null)

View File

@@ -43,7 +43,7 @@ export async function signIn<
// TODO: Handle custom base path
// TODO: Remove this since Sveltekit offers the CSRF protection via origin check
const { csrfToken } = await $fetch("/api/auth/csrf")
const { csrfToken } = await $fetch<{ csrfToken: string }>("/api/auth/csrf")
console.log(_signInUrl)

View File

@@ -1,13 +1,14 @@
import { AuthHandler, AuthOptions, Session } from "@auth/core"
import { AuthConfig, Session } from "@auth/core/types"
import { Auth } from "@auth/core"
import { fromNodeMiddleware, H3Event } from "h3"
import getURL from "requrl"
import { createMiddleware } from "@hattip/adapter-node"
export function NuxtAuthHandler(options: AuthOptions) {
export function NuxtAuthHandler(options: AuthConfig) {
async function handler(ctx: { request: Request }) {
options.trustHost ??= true
return AuthHandler(ctx.request, options)
return Auth(ctx.request, options)
}
const middleware = createMiddleware(handler)
@@ -17,7 +18,7 @@ export function NuxtAuthHandler(options: AuthOptions) {
export async function getSession(
event: H3Event,
options: AuthOptions
options: AuthConfig
): Promise<Session | null> {
options.trustHost ??= true
@@ -30,7 +31,7 @@ export async function getSession(
nodeHeaders.append(key, headers[key] as any)
})
const response = await AuthHandler(
const response = await Auth(
new Request(url, { headers: nodeHeaders }),
options
)

View File

@@ -1,21 +1,21 @@
{
"name": "playground-nuxt",
"name": "next-auth-nuxt",
"private": true,
"scripts": {
"build": "nuxt prepare && nuxt build",
"dev": "nuxt prepare && export NODE_OPTIONS='--no-experimental-fetch' && nuxt dev",
"build": "nuxt build",
"dev": "nuxt prepare && nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.1.1",
"eslint": "^8.29.0",
"h3": "1.0.2",
"nuxt": "3.0.0"
"h3": "1.6.6",
"nuxt": "3.5.1"
},
"dependencies": {
"@auth/core": "workspace:*",
"@hattip/adapter-node": "^0.0.22",
"@hattip/adapter-node": "^0.0.34",
"requrl": "^3.0.2"
}
}

View File

@@ -1,4 +1,4 @@
import { Session } from "@auth/core"
import { Session } from "@auth/core/types"
export default defineNuxtPlugin(async () => {
const session = useSession()

View File

@@ -1,10 +1,10 @@
import { NuxtAuthHandler } from "@/lib/auth/server"
import GithubProvider from "@auth/core/providers/github"
import type { AuthOptions } from "@auth/core"
import type { AuthConfig } from "@auth/core"
const runtimeConfig = useRuntimeConfig()
export const authOptions: AuthOptions = {
export const authOptions = {
secret: runtimeConfig.secret,
providers: [
GithubProvider({
@@ -12,6 +12,6 @@ export const authOptions: AuthOptions = {
clientSecret: runtimeConfig.github.clientSecret,
}),
],
}
} as AuthConfig
export default NuxtAuthHandler(authOptions)

View File

@@ -269,7 +269,7 @@ Ultimately if your request is not accepted or is not actively in development, yo
</summary>
<p>
Auth.js by default uses JSON Web Tokens for saving the user's session. However, if you use a [database adapter](/guides/adapters/using-a-database-adapter), the database will be used to persist the user's session. You can force the usage of JWT when using a database [through the configuration options](/reference/configuration/auth-config#session). Since v4 all our JWT tokens are now encrypted by default with A256GCM.
Auth.js by default uses JSON Web Tokens for saving the user's session. However, if you use a [database adapter](/guides/adapters/using-a-database-adapter), the database will be used to persist the user's session. You can force the usage of JWT when using a database [through the configuration options](/reference/configuration/auth-config#session). Since v4 all our JWTs are now encrypted by default with A256GCM.
</p>
</details>

View File

@@ -91,12 +91,12 @@ Finally, we'll need to set up a database adapter to store verification tokens th
An **Adapter** in Auth.js connects your application to whatever database or backend system you want to use to store data for users, their accounts, sessions, etc...
For this tutorial, we're going to use the **MongoDB** adapter, other any of the other adapters will work just fine.
For this tutorial, we're going to use the **MongoDB** adapter, but any of the other adapters will work just fine.
First, let's start by installing the adapter package:
```bash npm2yarn2pnpm
npm install -D @next-auth/mongodb-adapter mongodb
npm install -D @auth/mongodb-adapter mongodb
```
and create a simple MongoDB client:
@@ -142,7 +142,7 @@ And now let's reference this new adapter from our Auth.js configuration file:
```diff title="pages/api/auth/[...nextauth].ts"
import NextAuth from "next-auth"
import EmailProvider from "next-auth/providers/email"
+ import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
+ import { MongoDBAdapter } from "@auth/mongodb-adapter"
+ import clientPromise from "../../../lib/mongodb/client"
export default NextAuth({

View File

@@ -243,10 +243,13 @@ http://localhost:5173/auth/callback/github
TODO Core
</TabItem>
</Tabs>
:::info
The last part of the URL, `[provider]`, is the ID of the provider you're using. In this case, we're using GitHub, so it's `github`. If you're using Google, it'll be `google`, etc... We keep track of the provider IDs internally.
The same id is used in the `signIn()` method we saw earlier.
:::
To register, tap on "Register application" button.
The next screen shows all the configurations for your newly created OAuth app. For now, we need two things from it - the **Client ID** and **Client Secret**:

View File

@@ -6,7 +6,7 @@ Using a custom adapter you can connect to any database back-end or even several
## How to create an adapter
For more information about the data these methods need to manage see [models](/reference/adapters/models).
For more information about the data these methods need to manage see [models](/reference/adapters#models).
_See the code below for practical example._

View File

@@ -29,7 +29,7 @@ Sent when the user signs out.
The message object will contain one of these depending on if you use JWT or database persisted sessions:
- `token`: The JWT token for this session.
- `token`: The JWT for this session.
- `session`: The session object from your adapter that is being ended
### createUser
@@ -60,5 +60,5 @@ Sent at the end of a request for the current session.
The message object will contain one of these depending on if you use JWT or database persisted sessions:
- `token`: The JWT token for this session.
- `token`: The JWT for this session.
- `session`: The session object from your adapter.

View File

@@ -117,7 +117,7 @@ Using the database strategy is very similar, but instead of preserving the `acce
import { Auth } from "@auth/core"
import { type TokenSet } from "@auth/core/types"
import Google from "@auth/core/providers/google"
import { PrismaAdapter } from "@next-auth/prisma-adapter"
import { PrismaAdapter } from "@auth/prisma-adapter"
import { PrismaClient } from "@prisma/client"
const prisma = new PrismaClient()

View File

@@ -22,11 +22,18 @@ Next you will have to create some configuration files for Cypress.
First, the primary cypress config:
```js title="cypress.json"
{
"baseUrl": "http://localhost:3000",
"chromeWebSecurity": false
}
```ts title="cypress.config.ts"
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
chromeWebSecurity: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
})
```
This initial Cypress config will tell Cypress where to find your site on initial launch as well as allow it to open up URLs at domains that aren't your page, for example to be able to login to a social provider.
@@ -46,14 +53,24 @@ You must change the login credentials you want to use, but you can also redefine
Third, if you're using the `cypress-social-login` plugin, you must add this to your `/cypress/plugins/index.js` file like so:
```js title="cypress/plugins/index.js"
const { GoogleSocialLogin } = require("cypress-social-logins").plugins
```js title="cypress.config.ts" {3-4,10-14}
import { defineConfig } from 'cypress'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { GoogleSocialLogin } = require('cypress-social-logins').plugins
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
chromeWebSecurity: false,
setupNodeEvents(on, config) {
on('task', {
GoogleSocialLogin,
})
},
},
})
module.exports = (on, config) => {
on("task", {
GoogleSocialLogin: GoogleSocialLogin,
})
}
```
Finally, you can also add the following npm scripts to your `package.json`:
@@ -110,10 +127,6 @@ describe("Login page", () => {
secure: cookie.secure,
})
Cypress.Cookies.defaults({
preserve: cookieName,
})
// remove the two lines below if you need to stay logged in
// for your remaining tests
cy.visit("/api/auth/signout")

View File

@@ -2,7 +2,7 @@
title: Overview
---
Using a Auth.js / NextAuth.js adapter you can connect to any database service or even several different services at the same time. The following listed official adapters are created and maintained by the community:
Using an Auth.js / NextAuth.js adapter you can connect to any database service or even several different services at the same time. The following listed official adapters are created and maintained by the community:
<div class="adapter-card-list">
<a href="/reference/adapter/dgraph" class="adapter-card">
@@ -71,7 +71,7 @@ If you don't find an adapter for the database or service you use, you can always
## Models
Auth.js can be used with any database. Models tell you what structures Auth.js expects from your database. Models will vary slightly depending on which adapter you use, but in general, will look something like this. Each adapter's model/schema will be slightly adapted for its needs, but will look very much like this schema below:
Auth.js can be used with any database. Models tell you what structures Auth.js expects from your database. Models will vary slightly depending on which adapter you use, but in general, will look something like this:
```mermaid
erDiagram
@@ -103,8 +103,6 @@ erDiagram
string scope
string id_token
string session_state
string oauth_token_secret
string oauth_token
}
VerificationToken {
string identifier
@@ -113,10 +111,10 @@ erDiagram
}
```
More information about each Model / Table can be found below.
More information about each Model/Table can be found below.
:::note
You can [create your own adapter](/guides/adapters/creating-a-database-adapter) if you want to use Auth.js with a database that is not supported out of the box, or you have to change fields on any of the models.
You can [create your adapter](/guides/adapters/creating-a-database-adapter) if you want to use Auth.js with a database that is not supported out of the box, or you have to change fields on any of the models.
:::
---
@@ -125,30 +123,31 @@ You can [create your own adapter](/guides/adapters/creating-a-database-adapter)
The User model is for information such as the user's name and email address.
Email address is optional, but if one is specified for a User then it must be unique.
Email address is optional, but if one is specified for a User, then it must be unique.
:::note
If a user first signs in with OAuth then their email address is automatically populated using the one from their OAuth profile, if the OAuth provider returns one.
If a user first signs in with an OAuth provider, then their email address is automatically populated using the one from their OAuth profile if the OAuth provider returns one.
This provides a way to contact users and for users to maintain access to their account and sign in using email in the event they are unable to sign in with the OAuth provider in future (if the [Email Provider](/getting-started/email-tutorial) is configured).
This provides a way to contact users and for users to maintain access to their account and sign in using email in the event they are unable to sign in with the OAuth provider in the future (if the [Email Provider](/reference/core/providers_email) is configured).
:::
User creation in the database is automatic, and happens when the user is logging in for the first time with a provider. The default data saved is `id`, `name`, `email` and `image`. You can add more profile data by returning extra fields in your [OAuth provider](/guides/providers/custom-provider)'s [`profile()`](/reference/core/providers#profile) callback.
User creation in the database is automatic and happens when the user is logging in for the first time with a provider.
If the first sign-in is via the [OAuth Provider](/reference/core/providers_oauth), the default data saved is `id`, `name`, `email` and `image`. You can add more profile data by returning extra fields in your [OAuth provider](/guides/providers/custom-provider)'s [`profile()`](/reference/core/providers#profile) callback.
If the first sign-in is via the [Email Provider](/reference/core/providers_email), then the saved user will have `id`, `email`, `emailVerified`, where `emailVerified` is the timestamp of when the user was created.
### Account
The Account model is for information about OAuth accounts associated with a User. It will usually contain `access_token`, `id_token` and other OAuth specific data. [`TokenSet`](https://github.com/panva/node-openid-client/blob/main/docs/README.md#new-tokensetinput) from `openid-client` might give you an idea of all the fields.
:::note
In case of an OAuth 1.0 provider (like Twitter), you will have to look for `oauth_token` and `oauth_token_secret` string fields. GitHub also has an extra `refresh_token_expires_in` integer field. You have to make sure that your database schema includes these fields.
:::
The Account model is for information about OAuth accounts associated with a User
A single User can have multiple Accounts, but each Account can only have one User.
Linking Accounts to Users happen automatically, only when they have the same e-mail address, and the user is currently signed in. Check the [FAQ](/concepts/faq#security) for more information why this is a requirement.
Account creation in the database is automatic and happens when the user is logging in for the first time with a provider, or the [`Adapter.linkAccount`](/reference/core/adapters#linkaccount) method is invoked. The default data saved is `access_token`, `expires_at`, `refresh_token`, `id_token`, `token_type`, `scope` and `session_state`. You can save other fields or remove the ones you don't need by returning them in the [OAuth provider](/guides/providers/custom-provider)'s [`account()`](/reference/core/providers#account) callback.
Linking Accounts to Users happen automatically, only when they have the same e-mail address, and the user is currently signed in. Check the [FAQ](/concepts/faq#security) for more information on why this is a requirement.
:::tip
You can manually unlink accounts, if your adapter implements the `unlinkAccount` method. Make sure to take all the necessary security steps to avoid data loss.
You can manually unlink accounts if your adapter implements the `unlinkAccount` method. Make sure to take all the necessary security steps to avoid data loss.
:::
:::note
@@ -162,7 +161,7 @@ The Session model is used for database sessions. It is not used if JSON Web Toke
A single User can have multiple Sessions, each Session can only have one User.
:::tip
When a Session is read, we check if it's `expires` field indicates an invalid session, and delete it from the database. You can also do this clean-up periodically in the background to avoid our extra delete call to the database during an active session retrieval. This might result in a slight performance increase in a few cases.
When a Session is read, we check if its `expires` field indicates an invalid session, and delete it from the database. You can also do this clean-up periodically in the background to avoid our extra delete call to the database during an active session retrieval. This might result in a slight performance increase in a few cases.
:::
### Verification Token
@@ -171,7 +170,7 @@ The Verification Token model is used to store tokens for passwordless sign in.
A single User can have multiple open Verification Tokens (e.g. to sign in to different devices).
It has been designed to be extendable for other verification purposes in the future (e.g. 2FA / short codes).
It has been designed to be extendable for other verification purposes in the future (e.g. 2FA / magic codes, etc.).
:::note
Auth.js makes sure that every token is usable only once, and by default has a short (1 day, can be configured by [`maxAge`](/guides/providers/email)) lifetime. If your user did not manage to finish the sign-in flow in time, they will have to start the sign-in process again.
@@ -183,8 +182,7 @@ Due to users forgetting or failing at the sign-in flow, you might end up with un
## RDBMS Naming Convention
Auth.js / NextAuth.js uses `camelCase` for its own database rows, while respecting the conventional `snake_case` formatting for OAuth related values. If mixed casing is an issue for you, most adapters have a dedicated section on how to use a single naming convention.
Auth.js / NextAuth.js uses `camelCase` for its database rows while respecting the conventional `snake_case` formatting for OAuth-related values. If the mixed casing is an issue for you, most adapters have a dedicated documentation section on how to force a casing convention.
## TypeScript

View File

@@ -7,7 +7,7 @@ const path = require("path")
const coreSrc = "../packages/core/src"
const providers = fs
.readdirSync(path.join(__dirname, coreSrc, "/providers"))
.filter((file) => file.endsWith(".ts") && !file.startsWith("oauth"))
.filter((file) => file.endsWith(".ts"))
.map((p) => `${coreSrc}/providers/${p}`)
const typedocConfig = require("./typedoc.json")
@@ -273,19 +273,7 @@ const docusaurusConfig = {
typedocAdapter("Neo4j"),
typedocAdapter("PouchDB"),
typedocAdapter("Prisma"),
[
"docusaurus-plugin-typedoc",
{
...typedocConfig,
id: "typeorm",
plugin: [require.resolve("./typedoc-mdn-links")],
watch: process.env.TYPEDOC_WATCH,
entryPoints: [`../packages/adapter-typeorm-legacy/src/index.ts`],
tsconfig: `../packages/adapter-typeorm-legacy/tsconfig.json`,
out: `reference/adapter/typeorm`,
sidebar: { indexLabel: "TypeORM" },
},
],
typedocAdapter("TypeORM"),
typedocAdapter("Sequelize"),
typedocAdapter("Supabase"),
typedocAdapter("Upstash Redis"),

View File

@@ -7,6 +7,7 @@ const icons = [
"/img/providers/apple.svg",
"/img/providers/auth0.svg",
"/img/providers/cognito.svg",
"/img/providers/descope.svg",
"/img/providers/battlenet.svg",
"/img/providers/box.svg",
"/img/providers/facebook.svg",

View File

@@ -29,6 +29,7 @@ html[data-theme="dark"] .adapter-card {
color: #f5f5f5;
}
html[data-theme="dark"] .adapter-card:hover,
.adapter-card:hover {
text-decoration: none;
color: black;

50
docs/static/img/providers/descope.svg vendored Normal file
View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="194.7px" height="215.2px" viewBox="0 0 194.7 215.2" style="enable-background:new 0 0 194.7 215.2;" xml:space="preserve"
>
<style type="text/css">
.st0{fill:url(#SVGID_1_);}
.st1{fill:url(#SVGID_00000004519561486438896460000001266960168497785022_);}
.st2{fill:url(#SVGID_00000049204468076180615810000015113731544435055266_);}
.st3{fill:url(#SVGID_00000116951257355544416270000003794629356563808950_);}
</style>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="68.3919" y1="222.1531" x2="185.0265" y2="41.0264">
<stop offset="1.481436e-07" style="stop-color:#0083B5"/>
<stop offset="0.4173" style="stop-color:#00FFFF"/>
<stop offset="0.9952" style="stop-color:#6FF12D"/>
</linearGradient>
<path class="st0" d="M129.8,174.7c7.6-1.6,14-4.8,19.2-9.7c7.7-7.3,8.8-17.1,8.8-29.4V80.7c0-12.3-1.1-22.1-8.8-29.4
c-5.2-4.9-11.6-8.1-19.2-9.7V15.4c12.5,1.8,22.9,6.5,31,14.2c10.6,10,19.9,23.5,19.9,40.5v75c0,17-9.3,30.5-19.9,40.5
c-8.1,7.7-18.5,12.4-31,14.2V174.7z"/>
<linearGradient id="SVGID_00000040544740507634666800000017273841385603649669_" gradientUnits="userSpaceOnUse" x1="5.037" y1="181.3564" x2="121.6716" y2="0.2297">
<stop offset="1.481436e-07" style="stop-color:#0083B5"/>
<stop offset="0.4173" style="stop-color:#00FFFF"/>
<stop offset="0.9952" style="stop-color:#6FF12D"/>
</linearGradient>
<path style="fill:url(#SVGID_00000040544740507634666800000017273841385603649669_);" d="M33.9,29.6c8.1-7.7,18.5-12.4,31-14.2
v26.3c-7.6,1.6-14,4.8-19.2,9.7c-7.7,7.3-8.8,17-8.8,29.2v55.1c0,12.3,1.1,22.1,8.8,29.4c5.2,4.9,11.6,8.1,19.2,9.7v25.1
c-12.5-1.8-22.9-6.5-31-14.2c-10.6-10-19.9-23.5-19.9-40.5V69.8C13.9,53,23.2,39.6,33.9,29.6z"/>
<g>
<linearGradient id="SVGID_00000060713993868866928010000000698955780952733088_" gradientUnits="userSpaceOnUse" x1="22.0278" y1="192.2974" x2="138.6624" y2="11.1707">
<stop offset="1.481436e-07" style="stop-color:#0083B5"/>
<stop offset="0.4173" style="stop-color:#00FFFF"/>
<stop offset="0.9952" style="stop-color:#6FF12D"/>
</linearGradient>
<path style="fill:url(#SVGID_00000060713993868866928010000000698955780952733088_);" d="M120.2,87.8l8.5-13.7l-17.8-9.4
l-7.5,14.2c-1.1,2.1-3.1,3.3-5.5,3.3c-2.3,0-4.4-1.2-5.5-3.3L85,64.7L67.3,74l12.3,19.7L120.2,87.8z"/>
<linearGradient id="SVGID_00000115475840050352750520000000840372054167564949_" gradientUnits="userSpaceOnUse" x1="37.9651" y1="202.5601" x2="154.5998" y2="21.4334">
<stop offset="1.481436e-07" style="stop-color:#0083B5"/>
<stop offset="0.4173" style="stop-color:#00FFFF"/>
<stop offset="0.9952" style="stop-color:#6FF12D"/>
</linearGradient>
<path style="fill:url(#SVGID_00000115475840050352750520000000840372054167564949_);" d="M142.4,97.7l-87.8,0.8v17.7l27.5-0.1
l-14.8,23.8l17.7,9.3l7.5-14.2c1.1-2.1,3.1-3.3,5.5-3.3c2.3,0,4.4,1.2,5.5,3.3l7.5,14.2l17.8-9.4l-12-19.3L93.7,116l48.7-0.2V97.7
z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -43,7 +43,7 @@
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "2.8.1",
"prettier-plugin-svelte": "^2.8.1",
"turbo": "1.8.8",
"turbo": "1.10.1",
"typescript": "4.9.4"
},
"engines": {

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Dgraph Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/dgraph-adapter">
<a href="https://npm.im/@auth/dgraph-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/dgraph-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/dgraph-adapter?color=green&label=@next-auth/dgraph-adapter&style=flat-square">
<a href="https://npm.im/@auth/dgraph-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/dgraph-adapter?color=green&label=@auth/dgraph-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/dgraph-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/dgraph-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/dgraph-adapter">
<img src="https://img.shields.io/npm/dm/@auth/dgraph-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,19 +1,30 @@
{
"name": "@next-auth/dgraph-adapter",
"version": "1.0.6",
"description": "Dgraph adapter for next-auth.",
"name": "@auth/dgraph-adapter",
"version": "1.0.0",
"description": "Dgraph adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"author": "Arnaud Derbey <arnaud@derbey.dev>",
"contributors": [],
"main": "dist/index.js",
"files": [
"dist",
"index.d.ts"
"contributors": [
"Balázs Orbán <info@balazsorban.com>"
],
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"lib",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -29,10 +40,6 @@
"build": "tsc",
"test": "./tests/test.sh"
},
"peerDependencies": {
"jsonwebtoken": "^8.5.1",
"next-auth": "^4"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
@@ -40,12 +47,12 @@
"@types/jsonwebtoken": "^8.5.5",
"@types/node-fetch": "^2.5.11",
"jest": "^27.4.3",
"next-auth": "workspace:*",
"ts-jest": "^27.0.3"
"ts-jest": "^27.0.3",
"undici": "5.22.1"
},
"dependencies": {
"jsonwebtoken": "^8.5.1",
"node-fetch": "^2.6.1"
"@auth/core": "workspace:*",
"jsonwebtoken": "^8.5.1"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"

View File

@@ -9,18 +9,18 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/dgraph-adapter
* npm install next-auth @auth/dgraph-adapter
* ```
*
* @module @next-auth/dgraph-adapter
* @module @auth/dgraph-adapter
*/
import { client as dgraphClient } from "./client"
import { format } from "./utils"
import type { Adapter } from "next-auth/adapters"
import type { DgraphClientParams } from "./client"
import * as defaultFragments from "./graphql/fragments"
import { client as dgraphClient } from "./lib/client"
import { format } from "./lib/utils"
import type { Adapter } from "@auth/core/adapters"
import type { DgraphClientParams } from "./lib/client"
import * as defaultFragments from "./lib/graphql/fragments"
export type { DgraphClientParams, DgraphClientError } from "./client"
export type { DgraphClientParams, DgraphClientError } from "./lib/client"
/** This is the interface of the Dgraph adapter options. */
export interface DgraphAdapterOptions {
@@ -28,7 +28,7 @@ export interface DgraphAdapterOptions {
* The GraphQL {@link https://dgraph.io/docs/query-language/fragments/ Fragments} you can supply to the adapter
* to define how the shapes of the `user`, `account`, `session`, `verificationToken` entities look.
*
* By default the adapter will uses the [default defined fragments](https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-dgraph/src/graphql/fragments.ts)
* By default the adapter will uses the [default defined fragments](https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-dgraph/src/lib/graphql/fragments.ts)
* , this config option allows to extend them.
*/
fragments?: {
@@ -48,7 +48,7 @@ export { format }
*
* ```ts title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import { DgraphAdapter } from "@next-auth/dgraph-adapter"
* import { DgraphAdapter } from "@auth/dgraph-adapter"
*
* export default NextAuth({
* providers: [],

View File

@@ -1,7 +1,4 @@
import * as jwt from "jsonwebtoken"
import fetch from "node-fetch"
import type { HeadersInit } from "node-fetch"
export interface DgraphClientParams {
endpoint: string

View File

@@ -1,12 +1,14 @@
import { DgraphAdapter, format } from "../src"
import { client as dgraphClient } from "../src/client"
import * as fragments from "../src/graphql/fragments"
import { client as dgraphClient } from "../src/lib/client"
import * as fragments from "../src/lib/graphql/fragments"
import { runBasicTests } from "@next-auth/adapter-test"
import fs from "fs"
import path from "path"
import type { DgraphClientParams } from "../src"
globalThis.fetch ??= require("undici").fetch
const params: DgraphClientParams = {
endpoint: "http://localhost:8080/graphql",
authToken: "test",

View File

@@ -21,7 +21,7 @@ dgraph/standalone
echo "Waiting 15 sec for db to start..." && sleep 15
head -n -1 src/graphql/schema.gql > tests/test.schema.gql
head -n -1 src/lib/graphql/schema.gql > tests/test.schema.gql
PUBLIC_KEY=$(sed 's/$/\\n/' tests/public.key | tr -d '\n')
echo "# Dgraph.Authorization {\"VerificationKey\":\"$PUBLIC_KEY\",\"Namespace\":\"https://dgraph.io/jwt/claims\",\"Header\":\"Authorization\",\"Algo\":\"RS256\"}" >> tests/test.schema.gql

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>DynamoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/dynamodb-adapter">
<a href="https://npm.im/@auth/dynamodb-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/dynamodb-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/dynamodb-adapter?color=green&label=@next-auth/dynamodb-adapter&style=flat-square">
<a href="https://npm.im/@auth/dynamodb-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/dynamodb-adapter?color=green&label=@auth/dynamodb-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/dynamodb-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/dynamodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/dynamodb-adapter">
<img src="https://img.shields.io/npm/dm/@auth/dynamodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,7 +1,7 @@
{
"name": "@next-auth/dynamodb-adapter",
"name": "@auth/dynamodb-adapter",
"repository": "https://github.com/nextauthjs/next-auth",
"version": "3.0.2",
"version": "1.0.0",
"description": "AWS DynamoDB adapter for next-auth.",
"keywords": [
"next-auth",
@@ -9,18 +9,10 @@
"oauth",
"dynamodb"
],
"type": "module",
"types": "./index.d.ts",
"homepage": "https://authjs.dev",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"private": false,
"publishConfig": {
"access": "public"
@@ -32,19 +24,27 @@
"clean": "rm -rf index.*",
"build": "pnpm clean && tsc"
},
"author": "Pol Marnette",
"contributors": [
"Balázs Orbán <info@balazsorban.com>"
],
"license": "ISC",
"type": "module",
"types": "./index.d.ts",
"files": [
"README.md",
"index.js",
"index.d.ts",
"index.d.ts.map",
"*.js",
"*.d.ts*",
"src"
],
"author": "Pol Marnette",
"license": "ISC",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"peerDependencies": {
"@aws-sdk/client-dynamodb": "^3.36.1",
"@aws-sdk/lib-dynamodb": "^3.36.1",
"next-auth": "^4"
"@aws-sdk/lib-dynamodb": "^3.36.1"
},
"devDependencies": {
"@aws-sdk/client-dynamodb": "^3.36.1",
@@ -52,11 +52,9 @@
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"@shelf/jest-dynamodb": "^2.1.0",
"@types/uuid": "^9.0.0",
"jest": "^27.4.3",
"next-auth": "workspace:*"
"jest": "^27.4.3"
},
"dependencies": {
"uuid": "^9.0.0"
"@auth/core": "workspace:*"
}
}

View File

@@ -9,12 +9,11 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/dynamodb-adapter
* npm install next-auth @auth/dynamodb-adapter
* ```
*
* @module @next-auth/dynamodb-adapter
* @module @auth/dynamodb-adapter
*/
import { v4 as uuid } from "uuid"
import type {
BatchWriteCommandInput,
@@ -26,7 +25,7 @@ import type {
AdapterAccount,
AdapterUser,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
export interface DynamoDBAdapterOptions {
tableName?: string
@@ -53,7 +52,7 @@ export interface DynamoDBAdapterOptions {
* import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb"
* import NextAuth from "next-auth";
* import Providers from "next-auth/providers";
* import { DynamoDBAdapter } from "@next-auth/dynamodb-adapter"
* import { DynamoDBAdapter } from "@auth/dynamodb-adapter"
*
* const config: DynamoDBClientConfig = {
* credentials: {
@@ -187,7 +186,7 @@ export function DynamoDBAdapter(
async createUser(data) {
const user: AdapterUser = {
...(data as any),
id: uuid(),
id: crypto.randomUUID(),
}
await client.put({
@@ -312,7 +311,7 @@ export function DynamoDBAdapter(
async linkAccount(data) {
const item = {
...data,
id: uuid(),
id: crypto.randomUUID(),
[pk]: `USER#${data.userId}`,
[sk]: `ACCOUNT#${data.provider}#${data.providerAccountId}`,
[GSI1PK]: `ACCOUNT#${data.provider}`,
@@ -376,7 +375,7 @@ export function DynamoDBAdapter(
},
async createSession(data) {
const session = {
id: uuid(),
id: crypto.randomUUID(),
...data,
}
await client.put({

View File

@@ -1,16 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": ".",
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js", "jest-dynamodb-config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Fauna Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/fauna-adapter">
<a href="https://npm.im/@auth/fauna-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/fauna-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/fauna-adapter?color=green&label=@next-auth/fauna-adapter&style=flat-square">
<a href="https://npm.im/@auth/fauna-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/fauna-adapter?color=green&label=@auth/fauna-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/fauna-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/fauna-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/fauna-adapter">
<img src="https://img.shields.io/npm/dm/@auth/fauna-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,28 +1,30 @@
{
"name": "@next-auth/fauna-adapter",
"version": "1.0.4",
"description": "Fauna Adapter for NextAuth",
"name": "@auth/fauna-adapter",
"version": "1.0.0",
"description": "Fauna Adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"files": [
"dist",
"README.md"
],
"author": "Bhanu Teja P",
"contributors": [
{
"name": "Nico Domino",
"email": "yo@ndo.dev"
},
{
"name": "Balázs Orbán",
"email": "info@balazsorban.com"
}
"Nico Domino <yo@ndo.dev>",
"Balázs Orbán <info@balazsorban.com>"
],
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -41,19 +43,20 @@
"migrate": "fauna-schema-migrate generate",
"test": "./tests/test.sh"
},
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"faunadb": "^4.3.0",
"next-auth": "^4"
"faunadb": "^4.3.0"
},
"devDependencies": {
"@fauna-labs/fauna-schema-migrate": "^2.1.3",
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"faunadb": "^4.3.0",
"jest": "^27.4.3",
"next-auth": "workspace:*"
"jest": "^27.4.3"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"
}
}
}

View File

@@ -10,10 +10,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/fauna-adapter faunadb
* npm install @auth/fauna-adapter faunadb
* ```
*
* @module @next-auth/fauna-adapter
* @module @auth/fauna-adapter
*/
import {
Client as FaunaClient,
@@ -44,7 +44,7 @@ import {
AdapterSession,
AdapterUser,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
export const collections = {
Users: Collection("users"),
@@ -137,7 +137,7 @@ export function query(f: FaunaClient, format: (...args: any) => any) {
* ```javascript title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import { Client as FaunaClient } from "faunadb"
* import { FaunaAdapter } from "@next-auth/fauna-adapter"
* import { FaunaAdapter } from "@auth/fauna-adapter"
*
* const client = new FaunaClient({
* secret: "secret",

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Firebase Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/firebase-adapter">
<a href="https://npm.im/@auth/firebase-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/firebase-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/firebase-adapter?color=green&label=@next-auth/firebase-adapter&style=flat-square">
<a href="https://npm.im/@auth/firebase-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/firebase-adapter?color=green&label=@auth/firebase-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/firebase-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/firebase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/firebase-adapter">
<img src="https://img.shields.io/npm/dm/@auth/firebase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,7 +1,7 @@
{
"name": "@next-auth/firebase-adapter",
"version": "2.0.1",
"description": "Firebase adapter for next-auth.",
"name": "@auth/firebase-adapter",
"version": "1.0.0",
"description": "Firebase adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
@@ -13,17 +13,18 @@
"Alex Meuer <github@alexmeuer.com>"
],
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"files": [
"src",
"*.js",
"*.d.ts*"
],
"license": "ISC",
"keywords": [
"next-auth",
@@ -40,16 +41,17 @@
"build": "tsc",
"test": "firebase emulators:exec --only firestore --project next-auth-test 'jest -c tests/jest.config.js'"
},
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"firebase-admin": "^11.4.1",
"next-auth": "^4"
"firebase-admin": "^11.4.1"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"firebase-admin": "^11.4.1",
"firebase-tools": "^11.16.1",
"jest": "^29.3.1",
"next-auth": "workspace:*"
"jest": "^29.3.1"
}
}

View File

@@ -12,10 +12,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/firebase-adapter firebase-admin
* npm install @auth/firebase-adapter firebase-admin
* ```
*
* @module @next-auth/firebase-adapter
* @module @auth/firebase-adapter
*/
import { type AppOptions, getApps, initializeApp } from "firebase-admin/app"
@@ -33,7 +33,7 @@ import type {
AdapterAccount,
AdapterSession,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
/** Configure the Firebase Adapter. */
export interface FirebaseAdapterConfig extends AppOptions {
@@ -52,7 +52,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
* @example
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
* import { FirestoreAdapter } from "@auth/firebase-adapter"
*
* export default NextAuth({
* adapter: FirestoreAdapter({ namingStrategy: "snake_case" })
@@ -78,7 +78,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
* @example
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
* import { FirestoreAdapter } from "@auth/firebase-adapter"
*
* export default NextAuth({
* adapter: FirestoreAdapter(),
@@ -95,7 +95,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
* @example
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
* import { FirestoreAdapter } from "@auth/firebase-adapter"
* import { cert } from "firebase-admin/app"
*
* export default NextAuth({
@@ -125,7 +125,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
* @example
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
* import { FirestoreAdapter } from "@auth/firebase-adapter"
* import { firestore } from "lib/firestore"
*
* export default NextAuth({
@@ -428,7 +428,7 @@ export function collectionsFactory(
*
* @example
* ```ts title="lib/firestore.ts"
* import { initFirestore } from "@next-auth/firebase-adapter"
* import { initFirestore } from "@auth/firebase-adapter"
* import { cert } from "firebase-admin/app"
*
* export const firestore = initFirestore({

View File

@@ -1,8 +1,9 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
@@ -18,6 +19,7 @@
"src/**/*"
],
"exclude": [
"tests"
"*.js",
"*.d.ts",
]
}

View File

@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>MikroORM Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/mikro-orm-adapter">
<a href="https://npm.im/@auth/mikro-orm-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/mikro-orm-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/mikro-orm-adapter?color=green&label=@next-auth/mikro-orm-adapter&style=flat-square">
<a href="https://npm.im/@auth/mikro-orm-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/mikro-orm-adapter?color=green&label=@auth/mikro-orm-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/mikro-orm-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/mikro-orm-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/mikro-orm-adapter">
<img src="https://img.shields.io/npm/dm/@auth/mikro-orm-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,7 +1,7 @@
{
"name": "@next-auth/mikro-orm-adapter",
"version": "3.0.1",
"description": "MikroORM adapter for next-auth.",
"name": "@auth/mikro-orm-adapter",
"version": "1.0.0",
"description": "MikroORM adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
@@ -11,7 +11,20 @@
"contributors": [
"Balázs Orbán <info@balazsorban.com>"
],
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"lib",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -27,27 +40,20 @@
"test": "jest --runInBand",
"build": "tsc"
},
"files": [
"README.md",
"dist"
],
"peerDependencies": {
"@mikro-orm/core": "^5",
"next-auth": "^4"
"@mikro-orm/core": "^5"
},
"devDependencies": {
"@mikro-orm/core": "^5",
"@mikro-orm/sqlite": "^5",
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"@types/uuid": ">=8",
"jest": "^29",
"next-auth": "workspace:*"
"jest": "^29"
},
"dependencies": {
"uuid": "^9"
"@auth/core": "workspace:*"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"
}
}
}

View File

@@ -9,10 +9,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/dynamodb-adapter @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
* npm install @mikro-orm/core @auth/mikro-orm-adapter
* ```
*
* @module @next-auth/dynamodb-adapter
* @module @auth/mikro-orm-adapter
*/
import type {
Connection,
@@ -20,11 +20,11 @@ import type {
Options as ORMOptions,
} from "@mikro-orm/core"
import type { Adapter } from "next-auth/adapters"
import type { Adapter } from "@auth/core/adapters"
import { MikroORM, wrap } from "@mikro-orm/core"
import * as defaultEntities from "./entities"
import * as defaultEntities from "./lib/entities"
export { defaultEntities }
@@ -35,7 +35,7 @@ export { defaultEntities }
*
* ```typescript title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import { MikroOrmAdapter } from "@next-auth/mikro-orm-adapter"
* import { MikroOrmAdapter } from "@auth/mikro-orm-adapter"
*
* export default NextAuth({
* adapter: MikroOrmAdapter({
@@ -67,7 +67,7 @@ export { defaultEntities }
* Property,
* Unique,
* } from "@mikro-orm/core"
* import { defaultEntities } from "@next-auth/mikro-orm-adapter"
* import { defaultEntities } from "@auth/mikro-orm-adapter"
*
* const { Account, Session } = defaultEntities
*
@@ -124,7 +124,7 @@ export { defaultEntities }
*
* ```typescript title="config/mikro-orm.ts"
* import { Options } from "@mikro-orm/core";
* import { defaultEntities } from "@next-auth/mikro-orm-adapter"
* import { defaultEntities } from "@auth/mikro-orm-adapter"
*
* const config: Options = {
* ...
@@ -186,7 +186,6 @@ export function MikroOrmAdapter<
* Method used in testing. You won't need to call this in your app.
* @internal
*/
// @ts-expect-error
async __disconnect() {
const em = await getEM()
await em.getConnection().close()
@@ -240,6 +239,7 @@ export function MikroOrmAdapter<
return wrap(user).toObject()
},
// @ts-expect-error
async linkAccount(data) {
const em = await getEM()
const user = await em.findOne(UserModel, { id: data.userId })
@@ -251,6 +251,7 @@ export function MikroOrmAdapter<
return wrap(account).toObject()
},
// @ts-expect-error
async unlinkAccount(provider_providerAccountId) {
const em = await getEM()
const account = await em.findOne(AccountModel, {

View File

@@ -1,5 +1,3 @@
import { v4 as randomUUID } from "uuid"
import {
Property,
Unique,
@@ -16,8 +14,7 @@ import type {
AdapterAccount,
AdapterSession,
VerificationToken as AdapterVerificationToken,
} from "next-auth/adapters"
import type { ProviderType } from "next-auth/providers"
} from "@auth/core/adapters"
type RemoveIndex<T> = {
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -27,7 +24,7 @@ type RemoveIndex<T> = {
@Entity()
export class User implements RemoveIndex<AdapterUser> {
@PrimaryKey()
id: string = randomUUID()
id: string = crypto.randomUUID()
@Property({ type: types.string, nullable: true })
name?: string
@@ -63,7 +60,7 @@ export class User implements RemoveIndex<AdapterUser> {
export class Session implements AdapterSession {
@PrimaryKey()
@Property({ type: types.string })
id: string = randomUUID()
id: string = crypto.randomUUID()
@ManyToOne({
entity: "User",
@@ -88,7 +85,7 @@ export class Session implements AdapterSession {
export class Account implements RemoveIndex<AdapterAccount> {
@PrimaryKey()
@Property({ type: types.string })
id: string = randomUUID()
id: string = crypto.randomUUID()
@ManyToOne({
entity: "User",
@@ -101,7 +98,7 @@ export class Account implements RemoveIndex<AdapterAccount> {
userId!: string
@Property({ type: types.string })
type!: ProviderType
type!: AdapterAccount["type"]
@Property({ type: types.string })
provider!: string

View File

@@ -13,13 +13,15 @@ import {
Options,
types,
} from "@mikro-orm/core"
import { randomUUID, runBasicTests } from "@next-auth/adapter-test"
import { runBasicTests } from "@next-auth/adapter-test"
globalThis.crypto ??= require("node:crypto").webcrypto
@Entity()
export class User implements defaultEntities.User {
@PrimaryKey()
@Property({ type: types.string })
id: string = randomUUID()
id: string = crypto.randomUUID()
@Property({ type: types.string, nullable: true })
name?: string
@@ -60,7 +62,7 @@ export class User implements defaultEntities.User {
export class VeryImportantEntity {
@PrimaryKey()
@Property({ type: types.string })
id: string = randomUUID()
id: string = crypto.randomUUID()
@Property({ type: types.boolean })
important = true

View File

@@ -1,13 +1,27 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist",
"stripInternal": true
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["src"],
"exclude": ["dist", "test", "node_modules"]
}
"include": [
"src/**/*",
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>MongoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/mongodb-adapter">
<a href="https://npm.im/@auth/mongodb-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/mongodb-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/mongodb-adapter?color=green&label=@next-auth/mongodb-adapter&style=flat-square">
<a href="https://npm.im/@auth/mongodb-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/mongodb-adapter?color=green&label=@auth/mongodb-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/mongodb-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/mongodb-adapter">
<img src="https://img.shields.io/npm/dm/@auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,14 +1,26 @@
{
"name": "@next-auth/mongodb-adapter",
"version": "1.1.3",
"description": "mongoDB adapter for next-auth.",
"name": "@auth/mongodb-adapter",
"version": "1.0.0",
"description": "MongoDB adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"author": "Balázs Orbán <info@balazsorban.com>",
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -26,20 +38,17 @@
"test:watch": "./tests/test.sh -w",
"build": "tsc"
},
"files": [
"README.md",
"dist"
],
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"mongodb": "^5 || ^4",
"next-auth": "^4"
"mongodb": "^5 || ^4"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"jest": "^27.4.3",
"mongodb": "^5.1.0",
"next-auth": "workspace:*"
"mongodb": "^5.1.0"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"

View File

@@ -9,10 +9,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/mongodb-adapter mongodb
* npm install @auth/mongodb-adapter mongodb
* ```
*
* @module @next-auth/mongodb-adapter
* @module @auth/mongodb-adapter
*/
import { ObjectId } from "mongodb"
@@ -22,7 +22,7 @@ import type {
AdapterAccount,
AdapterSession,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
import type { MongoClient } from "mongodb"
/** This is the interface of the MongoDB adapter options. */
@@ -132,7 +132,7 @@ export function _id(hex?: string) {
*
* ```js
* import NextAuth from "next-auth"
* import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
* import { MongoDBAdapter } from "@auth/mongodb-adapter"
* import clientPromise from "../../../lib/mongodb"
*
* // For more information on each option (and a full list of options) go to

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Neo4j Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/neo4j-adapter">
<a href="https://npm.im/@auth/neo4j-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/neo4j-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/neo4j-adapter?color=green&label=@next-auth/neo4j-adapter&style=flat-square">
<a href="https://npm.im/@auth/neo4j-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/neo4j-adapter?color=green&label=@auth/neo4j-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/neo4j-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/neo4j-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/neo4j-adapter">
<img src="https://img.shields.io/npm/dm/@auth/neo4j-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,7 +1,7 @@
{
"name": "@next-auth/neo4j-adapter",
"version": "1.0.6",
"description": "neo4j adapter for next-auth.",
"name": "@auth/neo4j-adapter",
"version": "1.0.0",
"description": "neo4j adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
@@ -11,7 +11,19 @@
"contributors": [
"Balázs Orbán <info@balazsorban.com>"
],
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -28,24 +40,18 @@
"test": "./tests/test.sh",
"build": "tsc"
},
"files": [
"README.md",
"dist"
],
"peerDependencies": {
"neo4j-driver": "^4.0.0 || ^5.7.0",
"next-auth": "^4"
"neo4j-driver": "^4.0.0 || ^5.7.0"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"@types/uuid": "^8.3.3",
"jest": "^27.4.3",
"neo4j-driver": "^5.7.0",
"next-auth": "workspace:*"
"neo4j-driver": "^5.7.0"
},
"dependencies": {
"uuid": "^8.3.2"
"@auth/core": "workspace:*"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"

View File

@@ -9,17 +9,13 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/neo4j-adapter neo4j-driver
* npm install @auth/neo4j-adapter neo4j-driver
* ```
*
* @module @next-auth/neo4j-adapter
* @module @auth/neo4j-adapter
*/
import type { Session } from "neo4j-driver"
import type { Adapter } from "next-auth/adapters"
import { v4 as uuid } from "uuid"
import { client, format } from "./utils"
export { format }
import { type Session, isInt, integer } from "neo4j-driver"
import type { Adapter } from "@auth/core/adapters"
/** This is the interface of the Neo4j adapter options. The Neo4j adapter takes a {@link https://neo4j.com/docs/bolt/current/driver-api/#driver-session Neo4j session} as its only argument. */
export interface Neo4jOptions extends Session {}
@@ -31,7 +27,7 @@ export interface Neo4jOptions extends Session {}
*
* ```javascript title="pages/api/auth/[...nextauth].js"
* import neo4j from "neo4j-driver"
* import { Neo4jAdapter } from "@next-auth/neo4j-adapter"
* import { Neo4jAdapter } from "@auth/neo4j-adapter"
*
* const driver = neo4j.driver(
* "bolt://localhost",
@@ -134,7 +130,7 @@ export function Neo4jAdapter(session: Session): Adapter {
return {
async createUser(data) {
const user: any = { id: uuid(), ...data }
const user = { id: crypto.randomUUID(), ...data }
await write(`CREATE (u:User $data)`, user)
return user
},
@@ -288,3 +284,69 @@ export function Neo4jAdapter(session: Session): Adapter {
},
}
}
// https://github.com/honeinc/is-iso-date/blob/master/index.js
const isoDateRE =
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
function isDate(value: any) {
return value && isoDateRE.test(value) && !isNaN(Date.parse(value))
}
export const format = {
/** Takes a plain old JavaScript object and turns it into a Neo4j compatible object */
to(object: Record<string, any>) {
const newObject: Record<string, unknown> = {}
for (const key in object) {
const value = object[key]
if (value instanceof Date) newObject[key] = value.toISOString()
else newObject[key] = value
}
return newObject
},
/** Takes a Neo4j object and returns a plain old JavaScript object */
from<T = Record<string, unknown>>(object?: Record<string, any>): T | null {
const newObject: Record<string, unknown> = {}
if (!object) return null
for (const key in object) {
const value = object[key]
if (isDate(value)) {
newObject[key] = new Date(value)
} else if (isInt(value)) {
if (integer.inSafeRange(value)) newObject[key] = value.toNumber()
else newObject[key] = value.toString()
} else {
newObject[key] = value
}
}
return newObject as T
},
}
function client(session: Session) {
return {
/** Reads values from the database */
async read<T>(statement: string, values?: any): Promise<T | null> {
const result = await session.readTransaction((tx) =>
tx.run(statement, values)
)
return format.from<T>(result?.records[0]?.get(0)) ?? null
},
/**
* Reads/writes values from/to the database.
* Properties are available under `$data`
*/
async write<T extends Record<string, any>>(
statement: string,
values: T
): Promise<any> {
const result = await session.writeTransaction((tx) =>
tx.run(statement, { data: format.to(values) })
)
return format.from<T>(result?.records[0]?.toObject())
},
}
}

View File

@@ -1,68 +0,0 @@
import type { Session } from "neo4j-driver"
import { isInt, integer } from "neo4j-driver"
// https://github.com/honeinc/is-iso-date/blob/master/index.js
const isoDateRE =
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
function isDate(value: any) {
return value && isoDateRE.test(value) && !isNaN(Date.parse(value))
}
export const format = {
/** Takes a plain old JavaScript object and turns it into a Neo4j compatible object */
to(object: Record<string, any>) {
const newObject: Record<string, unknown> = {}
for (const key in object) {
const value = object[key]
if (value instanceof Date) newObject[key] = value.toISOString()
else newObject[key] = value
}
return newObject
},
/** Takes a Neo4j object and returns a plain old JavaScript object */
from<T = Record<string, unknown>>(object?: Record<string, any>): T | null {
const newObject: Record<string, unknown> = {}
if (!object) return null
for (const key in object) {
const value = object[key]
if (isDate(value)) {
newObject[key] = new Date(value)
} else if (isInt(value)) {
if (integer.inSafeRange(value)) newObject[key] = value.toNumber()
else newObject[key] = value.toString()
} else {
newObject[key] = value
}
}
return newObject as T
},
}
export function client(session: Session) {
return {
/** Reads values from the database */
async read<T>(statement: string, values?: any): Promise<T | null> {
const result = await session.readTransaction((tx) =>
tx.run(statement, values)
)
return format.from<T>(result?.records[0]?.get(0)) ?? null
},
/**
* Reads/writes values from/to the database.
* Properties are available under `$data`
*/
async write<T extends Record<string, any>>(
statement: string,
values: T
): Promise<any> {
const result = await session.writeTransaction((tx) =>
tx.run(statement, { data: format.to(values) })
)
return format.from<T>(result?.records[0]?.toObject())
},
}
}

View File

@@ -4,6 +4,8 @@ import statements from "./resources/statements"
import { Neo4jAdapter, format } from "../src"
globalThis.crypto ??= require("node:crypto").webcrypto
const driver = neo4j.driver(
"bolt://localhost",
neo4j.auth.basic("neo4j", "password")

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>PouchDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/pouchdb-adapter">
<a href="https://npm.im/@auth/pouchdb-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/pouchdb-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/pouchdb-adapter?color=green&label=@next-auth/pouchdb-adapter&style=flat-square">
<a href="https://npm.im/@auth/pouchdb-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/pouchdb-adapter?color=green&label=@auth/pouchdb-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/pouchdb-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/pouchdb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/pouchdb-adapter">
<img src="https://img.shields.io/npm/dm/@auth/pouchdb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,5 +1,5 @@
{
"name": "@next-auth/pouchdb-adapter",
"name": "@auth/pouchdb-adapter",
"version": "1.0.0",
"description": "PouchDB adapter for next-auth.",
"homepage": "https://authjs.dev",
@@ -38,19 +38,17 @@
"src"
],
"peerDependencies": {
"next-auth": "^4",
"pouchdb": "^8.0.1",
"pouchdb-find": "^8.0.1"
},
"dependencies": {
"ulid": "2.3.0"
"@auth/core": "workspace:*"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"@types/pouchdb": "^6.4.0",
"jest": "^27.4.3",
"next-auth": "workspace:*",
"pouchdb": "^8.0.1",
"pouchdb-adapter-memory": "^8.0.1",
"pouchdb-find": "^8.0.1"

View File

@@ -9,10 +9,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth pouchdb pouchdb-find @next-auth/pouchdb-adapter
* npm install pouchdb pouchdb-find @auth/pouchdb-adapter
* ```
*
* @module @next-auth/pouchdb-adapter
* @module @auth/pouchdb-adapter
*/
import type {
@@ -21,8 +21,7 @@ import type {
AdapterSession,
AdapterUser,
VerificationToken,
} from "next-auth/adapters"
import { ulid } from "ulid"
} from "@auth/core/adapters"
type PrefixConfig = Record<
"user" | "account" | "session" | "verificationToken",
@@ -99,7 +98,7 @@ export interface PouchDBAdapterOptions {
* ```javascript title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import GoogleProvider from "next-auth/providers/google"
* import { PouchDBAdapter } from "@next-auth/pouchdb-adapter"
* import { PouchDBAdapter } from "@auth/pouchdb-adapter"
* import PouchDB from "pouchdb"
*
* // Setup your PouchDB instance and database
@@ -154,7 +153,7 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
return {
async createUser(user) {
const doc = { ...user, _id: [userPrefix, ulid()].join("_") }
const doc = { ...user, _id: [userPrefix, crypto.randomUUID()].join("_") }
await pouchdb.put(doc)
return { ...user, id: doc._id }
},
@@ -220,7 +219,10 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
async deleteUser(id) {},
async linkAccount(account) {
const doc = { ...account, _id: [accountPrefix, ulid()].join("_") }
const doc = {
...account,
_id: [accountPrefix, crypto.randomUUID()].join("_"),
}
await (pouchdb as unknown as PouchDB.Database<AdapterAccount>).put(doc)
return { ...account, id: doc._id }
@@ -245,7 +247,7 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
async createSession(data) {
const doc = {
_id: [sessionPrefix, ulid()].join("_"),
_id: [sessionPrefix, crypto.randomUUID()].join("_"),
...data,
}
await (pouchdb as unknown as PouchDB.Database<AdapterSession>).put(doc)
@@ -317,7 +319,7 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
async createVerificationToken(data) {
await (pouchdb as unknown as PouchDB.Database<VerificationToken>).put({
_id: [verificationTokenPrefix, ulid()].join("_"),
_id: [verificationTokenPrefix, crypto.randomUUID()].join("_"),
...data,
})

View File

@@ -10,13 +10,14 @@ import {
import PouchDB from "pouchdb"
import find from "pouchdb-find"
import memoryAdapter from "pouchdb-adapter-memory"
import { ulid } from "ulid"
import {
AdapterAccount,
AdapterSession,
AdapterUser,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
globalThis.crypto ??= require("node:crypto").webcrypto
// pouchdb setup
PouchDB.plugin(memoryAdapter).plugin(find)
@@ -31,7 +32,7 @@ PouchDB.on("destroyed", function () {
const disconnect = async () => {
if (!pouchdbIsDestroyed) await pouchdb.destroy()
}
pouchdb = new PouchDB(ulid(), { adapter: "memory" })
pouchdb = new PouchDB(crypto.randomUUID(), { adapter: "memory" })
// Basic tests
runBasicTests({

View File

@@ -1,17 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"allowSyntheticDefaultImports": true,
"outDir": ".",
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Prisma Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/prisma-adapter">
<a href="https://npm.im/@auth/prisma-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/prisma-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/prisma-adapter?color=green&label=@next-auth/prisma-adapter&style=flat-square">
<a href="https://npm.im/@auth/prisma-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/prisma-adapter?color=green&label=@auth/prisma-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/prisma-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/prisma-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/prisma-adapter">
<img src="https://img.shields.io/npm/dm/@auth/prisma-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,14 +1,29 @@
{
"name": "@next-auth/prisma-adapter",
"version": "1.0.6",
"description": "Prisma adapter for next-auth.",
"homepage": "https://authjs.dev",
"name": "@auth/prisma-adapter",
"version": "1.0.0",
"description": "Prisma adapter for Auth.js",
"homepage": "https://authjs.dev/reference/adapter/prisma",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"author": "William Luke",
"main": "dist/index.js",
"contributors": [
"Balázs Orbán <info@balazsorban.com>"
],
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -32,22 +47,19 @@
"dev": "prisma generate && tsc -w",
"studio": "prisma studio"
},
"files": [
"README.md",
"dist"
],
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"@prisma/client": ">=2.26.0 || >=3",
"next-auth": "^4"
"@prisma/client": ">=2.26.0 || >=3 || >=4"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"@prisma/client": "^3.10.0",
"@prisma/client": "^4.15.0",
"jest": "^27.4.3",
"mongodb": "^4.4.0",
"next-auth": "workspace:*",
"prisma": "^3.10.0"
"prisma": "^4.15.0"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"

View File

@@ -9,14 +9,14 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @prisma/client @next-auth/prisma-adapter
* npm install @prisma/client @auth/prisma-adapter
* npm install prisma --save-dev
* ```
*
* @module @next-auth/prisma-adapter
* @module @auth/prisma-adapter
*/
import type { PrismaClient, Prisma } from "@prisma/client"
import type { Adapter, AdapterAccount } from "next-auth/adapters"
import type { Adapter, AdapterAccount } from "@auth/core/adapters"
/**
* ## Setup
@@ -26,7 +26,7 @@ import type { Adapter, AdapterAccount } from "next-auth/adapters"
* ```js title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import GoogleProvider from "next-auth/providers/google"
* import { PrismaAdapter } from "@next-auth/prisma-adapter"
* import { PrismaAdapter } from "@auth/prisma-adapter"
* import { PrismaClient } from "@prisma/client"
*
* const prisma = new PrismaClient()
@@ -42,8 +42,6 @@ import type { Adapter, AdapterAccount } from "next-auth/adapters"
* })
* ```
*
* ## Advanced usage
*
* ### Create the Prisma schema from scratch
*
* You need to use at least Prisma 2.26.0. Create a schema file in `prisma/schema.prisma` similar to this one:

View File

@@ -1,9 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"include": ["."],
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Sequelize Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/sequelize-adapter">
<a href="https://npm.im/@auth/sequelize-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/sequelize-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/sequelize-adapter?color=green&label=@next-auth/sequelize-adapter&style=flat-square">
<a href="https://npm.im/@auth/sequelize-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/sequelize-adapter?color=green&label=@auth/sequelize-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/sequelize-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/sequelize-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/sequelize-adapter">
<img src="https://img.shields.io/npm/dm/@auth/sequelize-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,14 +1,26 @@
{
"name": "@next-auth/sequelize-adapter",
"version": "1.0.8",
"description": "Sequelize adapter for next-auth.",
"name": "@auth/sequelize-adapter",
"version": "1.0.1",
"description": "Sequelize adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"author": "github.com/luke-j",
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -21,22 +33,19 @@
"access": "public"
},
"scripts": {
"test:wip": "jest",
"test": "jest",
"build": "tsc"
},
"files": [
"README.md",
"dist"
],
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"next-auth": "^4",
"sequelize": "^6.6.5"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"jest": "^27.4.3",
"next-auth": "workspace:*",
"sequelize": "^6.6.5"
},
"jest": {

View File

@@ -9,10 +9,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/sequelize-adapter sequelize
* npm install next-auth @auth/sequelize-adapter sequelize
* ```
*
* @module @next-auth/sequelize-adapter
* @module @auth/sequelize-adapter
*/
import type {
Adapter,
@@ -20,13 +20,14 @@ import type {
AdapterAccount,
AdapterSession,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
import { Sequelize, Model, ModelCtor } from "sequelize"
import * as defaultModels from "./models"
import * as defaultModels from "./models.js"
export { defaultModels as models }
// @see https://sequelize.org/master/manual/typescript.html
//@ts-expect-error
interface AccountInstance
extends Model<AdapterAccount, Partial<AdapterAccount>>,
AdapterAccount {}
@@ -70,7 +71,7 @@ export interface SequelizeAdapterOptions {
*
* ```javascript title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import SequelizeAdapter from "@next-auth/sequelize-adapter"
* import SequelizeAdapter from "@auth/sequelize-adapter"
* import { Sequelize } from "sequelize"
*
* // https://sequelize.org/master/manual/getting-started.html#connecting-to-a-database
@@ -93,7 +94,7 @@ export interface SequelizeAdapterOptions {
*
* ```js
* import NextAuth from "next-auth"
* import SequelizeAdapter from "@next-auth/sequelize-adapter"
* import SequelizeAdapter from "@auth/sequelize-adapter"
* import Sequelize from 'sequelize'
*
* const sequelize = new Sequelize("sqlite::memory:")
@@ -117,7 +118,7 @@ export interface SequelizeAdapterOptions {
*
* ```js
* import NextAuth from "next-auth"
* import SequelizeAdapter, { models } from "@next-auth/sequelize-adapter"
* import SequelizeAdapter, { models } from "@auth/sequelize-adapter"
* import Sequelize, { DataTypes } from "sequelize"
*
* const sequelize = new Sequelize("sqlite::memory:")
@@ -218,6 +219,7 @@ export default function SequelizeAdapter(
await sync()
const accountInstance = await Account.findOne({
// @ts-expect-error
where: { provider, providerAccountId },
})

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Supabase Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/supabase-adapter">
<a href="https://npm.im/@auth/supabase-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/supabase-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/supabase-adapter?color=green&label=@next-auth/supabase-adapter&style=flat-square">
<a href="https://npm.im/@auth/supabase-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/supabase-adapter?color=green&label=@auth/supabase-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/supabase-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/supabase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/supabase-adapter">
<img src="https://img.shields.io/npm/dm/@auth/supabase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,14 +1,26 @@
{
"name": "@next-auth/supabase-adapter",
"version": "0.2.1",
"description": "Supabase adapter for next-auth.",
"name": "@auth/supabase-adapter",
"version": "0.1.2",
"description": "Supabase adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"author": "Martin Sonnberger <martin.sonnberger@icloud.com>",
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"keywords": [
"next-auth",
"next.js",
@@ -23,18 +35,19 @@
"build": "tsc",
"test": "./tests/test.sh"
},
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"@supabase/supabase-js": "^2.0.5",
"next-auth": "^4.18.7"
"@supabase/supabase-js": "^2.0.5"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:^0.0.0",
"@next-auth/tsconfig": "workspace:^0.0.0",
"@supabase/supabase-js": "^2.0.5",
"jest": "^27.4.3",
"next-auth": "workspace:*"
"jest": "^27.4.3"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"
}
}
}

View File

@@ -1,139 +0,0 @@
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json }
| Json[]
export interface Database {
next_auth: {
Tables: {
accounts: {
Row: {
id: string
type: string | null
provider: string | null
providerAccountId: string | null
refresh_token: string | null
access_token: string | null
expires_at: number | null
token_type: string | null
scope: string | null
id_token: string | null
session_state: string | null
oauth_token_secret: string | null
oauth_token: string | null
userId: string | null
}
Insert: {
id?: string
type?: string | null
provider?: string | null
providerAccountId?: string | null
refresh_token?: string | null
access_token?: string | null
expires_at?: number | null
token_type?: string | null
scope?: string | null
id_token?: string | null
session_state?: string | null
oauth_token_secret?: string | null
oauth_token?: string | null
userId?: string | null
}
Update: {
id?: string
type?: string | null
provider?: string | null
providerAccountId?: string | null
refresh_token?: string | null
access_token?: string | null
expires_at?: number | null
token_type?: string | null
scope?: string | null
id_token?: string | null
session_state?: string | null
oauth_token_secret?: string | null
oauth_token?: string | null
userId?: string | null
}
}
sessions: {
Row: {
expires: string | null
sessionToken: string | null
userId: string | null
id: string
}
Insert: {
expires?: string | null
sessionToken?: string | null
userId?: string | null
id?: string
}
Update: {
expires?: string | null
sessionToken?: string | null
userId?: string | null
id?: string
}
}
users: {
Row: {
name: string | null
email: string | null
emailVerified: string | null
image: string | null
id: string
}
Insert: {
name?: string | null
email?: string | null
emailVerified?: string | null
image?: string | null
id?: string
}
Update: {
name?: string | null
email?: string | null
emailVerified?: string | null
image?: string | null
id?: string
}
}
verification_tokens: {
Row: {
id: number
identifier: string | null
token: string | null
expires: string | null
}
Insert: {
id?: number
identifier?: string | null
token?: string | null
expires?: string | null
}
Update: {
id?: number
identifier?: string | null
token?: string | null
expires?: string | null
}
}
}
Views: {
[_ in never]: never
}
Functions: {
uid: {
Args: Record<PropertyKey, never>
Returns: string
}
}
Enums: {
[_ in never]: never
}
}
}

View File

@@ -9,19 +9,18 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install @supabase/supabase-js next-auth @next-auth/supabase-adapter
* npm install @supabase/supabase-js @auth/supabase-adapter
* ```
*
* @module @next-auth/supabase-adapter
* @module @auth/supabase-adapter
*/
import { createClient } from "@supabase/supabase-js"
import { Database } from "./database.types"
import {
Adapter,
AdapterSession,
AdapterUser,
VerificationToken,
} from "next-auth/adapters"
} from "@auth/core/adapters"
function isDate(date: any) {
return (
@@ -61,7 +60,7 @@ export interface SupabaseAdapterOptions {
* :::note
* This adapter is developed by the community and not officially maintained or supported by Supabase. It uses the Supabase Database to store user and session data in a separate `next_auth` schema. It is a standalone Auth server that does not interface with Supabase Auth and therefore provides a different feature set.
*
* If youre looking for an officially maintained Auth server with additional features like [built-in email server](https://supabase.com/docs/guides/auth/auth-email#configure-email-settings?utm_source=authjs-docs&medium=referral&campaign=authjs), [phone auth](https://supabase.com/docs/guides/auth/auth-twilio?utm_source=authjs-docs&medium=referral&campaign=authjs), and [Multi Factor Authentication (MFA / 2FA)](https://supabase.com/contact/mfa?utm_source=authjs-docs&medium=referral&campaign=authjs), please use [Supabase Auth](https://supabase.com/auth) with the [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs?utm_source=authjs-docs&medium=referral&campaign=authjs).
* If you're looking for an officially maintained Auth server with additional features like [built-in email server](https://supabase.com/docs/guides/auth/auth-email#configure-email-settings?utm_source=authjs-docs&medium=referral&campaign=authjs), [phone auth](https://supabase.com/docs/guides/auth/auth-twilio?utm_source=authjs-docs&medium=referral&campaign=authjs), and [Multi Factor Authentication (MFA / 2FA)](https://supabase.com/contact/mfa?utm_source=authjs-docs&medium=referral&campaign=authjs), please use [Supabase Auth](https://supabase.com/auth) with the [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs?utm_source=authjs-docs&medium=referral&campaign=authjs).
* :::
*
* ## Setup
@@ -72,7 +71,7 @@ export interface SupabaseAdapterOptions {
*
* ```js title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import { SupabaseAdapter } from "@next-auth/supabase-adapter"
* import { SupabaseAdapter } from "@auth/supabase-adapter"
*
* // For more information on each option (and a full list of options) go to
* // https://authjs.dev/reference/configuration/auth-config
@@ -224,7 +223,7 @@ export interface SupabaseAdapterOptions {
*
* ```js title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import { SupabaseAdapter } from "@next-auth/supabase-adapter"
* import { SupabaseAdapter } from "@auth/supabase-adapter"
* import jwt from "jsonwebtoken"
*
* // For more information on each option (and a full list of options) go to
@@ -350,9 +349,7 @@ export function SupabaseAdapter(options: SupabaseAdapterOptions): Adapter {
const { url, secret } = options
const supabase = createClient<Database, "next_auth">(url, secret, {
db: { schema: "next_auth" },
global: {
headers: { "X-Client-Info": "@next-auth/supabase-adapter@0.1.0" },
},
global: { headers: { "X-Client-Info": "@auth/supabase-adapter" } },
})
return {
async createUser(user) {
@@ -463,7 +460,7 @@ export function SupabaseAdapter(options: SupabaseAdapterOptions): Adapter {
return {
user: format<AdapterUser>(
user as Database["next_auth"]["Tables"]["users"]["Row"]
user as Database["next_auth"]["Tables"]["users"]["Row"][]
),
session: format<AdapterSession>(session),
}
@@ -524,3 +521,135 @@ export function SupabaseAdapter(options: SupabaseAdapterOptions): Adapter {
},
}
}
interface Database {
next_auth: {
Tables: {
accounts: {
Row: {
id: string
type: string | null
provider: string | null
providerAccountId: string | null
refresh_token: string | null
access_token: string | null
expires_at: number | null
token_type: string | null
scope: string | null
id_token: string | null
session_state: string | null
oauth_token_secret: string | null
oauth_token: string | null
userId: string | null
}
Insert: {
id?: string
type?: string | null
provider?: string | null
providerAccountId?: string | null
refresh_token?: string | null
access_token?: string | null
expires_at?: number | null
token_type?: string | null
scope?: string | null
id_token?: string | null
session_state?: string | null
oauth_token_secret?: string | null
oauth_token?: string | null
userId?: string | null
}
Update: {
id?: string
type?: string | null
provider?: string | null
providerAccountId?: string | null
refresh_token?: string | null
access_token?: string | null
expires_at?: number | null
token_type?: string | null
scope?: string | null
id_token?: string | null
session_state?: string | null
oauth_token_secret?: string | null
oauth_token?: string | null
userId?: string | null
}
}
sessions: {
Row: {
expires: string | null
sessionToken: string | null
userId: string | null
id: string
}
Insert: {
expires?: string | null
sessionToken?: string | null
userId?: string | null
id?: string
}
Update: {
expires?: string | null
sessionToken?: string | null
userId?: string | null
id?: string
}
}
users: {
Row: {
name: string | null
email: string | null
emailVerified: string | null
image: string | null
id: string
}
Insert: {
name?: string | null
email?: string | null
emailVerified?: string | null
image?: string | null
id?: string
}
Update: {
name?: string | null
email?: string | null
emailVerified?: string | null
image?: string | null
id?: string
}
}
verification_tokens: {
Row: {
id: number
identifier: string | null
token: string | null
expires: string | null
}
Insert: {
id?: number
identifier?: string | null
token?: string | null
expires?: string | null
}
Update: {
id?: number
identifier?: string | null
token?: string | null
expires?: string | null
}
}
}
Views: {
[_ in never]: never
}
Functions: {
uid: {
Args: Record<PropertyKey, never>
Returns: string
}
}
Enums: {
[_ in never]: never
}
}
}

View File

@@ -5,8 +5,8 @@ import type {
AdapterSession,
AdapterUser,
VerificationToken,
} from "next-auth/adapters"
import type { Account } from "next-auth"
} from "@auth/core/adapters"
import type { Account } from "@auth/core/types"
const url = process.env.SUPABASE_URL ?? "http://localhost:54321"
const secret =

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

View File

@@ -1,4 +1,4 @@
import type { Adapter } from "next-auth/adapters"
import type { Adapter } from "@auth/core/adapters"
import { createHash, randomUUID } from "crypto"
const requiredMethods = [
@@ -58,7 +58,8 @@ export async function runBasicTests(options: TestOptions) {
await options.db.connect?.()
})
const { adapter, db, skipTests } = options
const { adapter: _adapter, db, skipTests } = options
const adapter = _adapter as Required<Adapter>
afterAll(async () => {
// @ts-expect-error This is only used for the TypeORM adapter
@@ -88,7 +89,7 @@ export async function runBasicTests(options: TestOptions) {
providerAccountId: randomUUID(),
type: "oauth",
access_token: randomUUID(),
expires_at: ONE_MONTH,
expires_at: ONE_MONTH / 1000,
id_token: randomUUID(),
refresh_token: randomUUID(),
token_type: "bearer",

View File

@@ -1,9 +1,14 @@
// @ts-check
/** @type {import("@swc/core").Config} */
const swcConfig = {
jsc: {
parser: { syntax: "typescript", decorators: true },
transform: { legacyDecorator: true, decoratorMetadata: true },
},
}
/** @type {import("jest").Config} */
module.exports = {
transform: {
".(ts|tsx)$": ["@swc/jest", swcConfig],
@@ -16,4 +21,7 @@ module.exports = {
// collectCoverageFrom: ["<rootDir>/packages/*/src/**/*.{ts,tsx}"],
testURL: "http://localhost/",
moduleDirectories: ["node_modules"],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
}

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