mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
7 Commits
@auth/core
...
@auth/mong
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43deda5bfb | ||
|
|
7e79d8c509 | ||
|
|
ab051162a7 | ||
|
|
87298a0150 | ||
|
|
d6abccd9a0 | ||
|
|
2f35daae37 | ||
|
|
a0f3b04c43 |
4
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
4
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
@@ -26,14 +26,14 @@ body:
|
|||||||
- "@next-auth/fauna-adapter"
|
- "@next-auth/fauna-adapter"
|
||||||
- "@next-auth/firebase-adapter"
|
- "@next-auth/firebase-adapter"
|
||||||
- "@next-auth/mikro-orm-adapter"
|
- "@next-auth/mikro-orm-adapter"
|
||||||
- "@next-auth/mongodb-adapter"
|
- "@auth/mongodb-adapter"
|
||||||
- "@next-auth/neo4j-adapter"
|
- "@next-auth/neo4j-adapter"
|
||||||
- "@next-auth/pouchdb-adapter"
|
- "@next-auth/pouchdb-adapter"
|
||||||
- "@auth/prisma-adapter"
|
- "@auth/prisma-adapter"
|
||||||
- "@next-auth/sequelize-adapter"
|
- "@next-auth/sequelize-adapter"
|
||||||
- "@next-auth/supabase-adapter"
|
- "@next-auth/supabase-adapter"
|
||||||
- "@auth/typeorm-adapter"
|
- "@auth/typeorm-adapter"
|
||||||
- "@next-auth/upstash-redis-adapter"
|
- "@auth/upstash-redis-adapter"
|
||||||
- "@next-auth/xata-adapter"
|
- "@next-auth/xata-adapter"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
4
.github/issue-labeler.yml
vendored
4
.github/issue-labeler.yml
vendored
@@ -16,7 +16,7 @@ mikro-orm:
|
|||||||
- "@next-auth/mikro-orm-adapter"
|
- "@next-auth/mikro-orm-adapter"
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
- "@next-auth/mongodb-adapter"
|
- "@auth/mongodb-adapter"
|
||||||
|
|
||||||
neo4j:
|
neo4j:
|
||||||
- "@next-auth/neo4j-adapter"
|
- "@next-auth/neo4j-adapter"
|
||||||
@@ -37,7 +37,7 @@ typeorm:
|
|||||||
- "@auth/typeorm-adapter"
|
- "@auth/typeorm-adapter"
|
||||||
|
|
||||||
upstash-redis:
|
upstash-redis:
|
||||||
- "@next-auth/upstash-redis-adapter"
|
- "@auth/upstash-redis-adapter"
|
||||||
|
|
||||||
xata:
|
xata:
|
||||||
- "@next-auth/xata-adapter"
|
- "@next-auth/xata-adapter"
|
||||||
|
|||||||
@@ -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...
|
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:
|
First, let's start by installing the adapter package:
|
||||||
|
|
||||||
```bash npm2yarn2pnpm
|
```bash npm2yarn2pnpm
|
||||||
npm install -D @next-auth/mongodb-adapter mongodb
|
npm install -D @auth/mongodb-adapter mongodb
|
||||||
```
|
```
|
||||||
|
|
||||||
and create a simple MongoDB client:
|
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"
|
```diff title="pages/api/auth/[...nextauth].ts"
|
||||||
import NextAuth from "next-auth"
|
import NextAuth from "next-auth"
|
||||||
import EmailProvider from "next-auth/providers/email"
|
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"
|
+ import clientPromise from "../../../lib/mongodb/client"
|
||||||
|
|
||||||
export default NextAuth({
|
export default NextAuth({
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>MongoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>MongoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/mongodb-adapter">
|
<a href="https://npm.im/@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">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/mongodb-adapter?color=green&label=@auth/mongodb-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/mongodb-adapter">
|
<a href="https://www.npmtrends.com/@auth/mongodb-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/mongodb-adapter",
|
"name": "@auth/mongodb-adapter",
|
||||||
"version": "1.1.3",
|
"version": "1.0.0",
|
||||||
"description": "mongoDB adapter for next-auth.",
|
"description": "MongoDB adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "Balázs Orbán <info@balazsorban.com>",
|
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -26,20 +38,17 @@
|
|||||||
"test:watch": "./tests/test.sh -w",
|
"test:watch": "./tests/test.sh -w",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
"dependencies": {
|
||||||
"README.md",
|
"@auth/core": "workspace:*"
|
||||||
"dist"
|
},
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"mongodb": "^5 || ^4",
|
"mongodb": "^5 || ^4"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"mongodb": "^5.1.0",
|
"mongodb": "^5.1.0"
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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"
|
import { ObjectId } from "mongodb"
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import type { MongoClient } from "mongodb"
|
import type { MongoClient } from "mongodb"
|
||||||
|
|
||||||
/** This is the interface of the MongoDB adapter options. */
|
/** This is the interface of the MongoDB adapter options. */
|
||||||
@@ -132,7 +132,7 @@ export function _id(hex?: string) {
|
|||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
|
* import { MongoDBAdapter } from "@auth/mongodb-adapter"
|
||||||
* import clientPromise from "../../../lib/mongodb"
|
* import clientPromise from "../../../lib/mongodb"
|
||||||
*
|
*
|
||||||
* // For more information on each option (and a full list of options) go to
|
* // For more information on each option (and a full list of options) go to
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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",
|
||||||
|
]
|
||||||
|
}
|
||||||
1
packages/adapter-upstash-redis/.npmrc
Normal file
1
packages/adapter-upstash-redis/.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Upstash Redis Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Upstash Redis Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/upstash-redis-adapter">
|
<a href="https://npm.im/@auth/upstash-redis-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/upstash-redis-adapter">
|
<a href="https://npm.im/@auth/upstash-redis-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/upstash-redis-adapter?color=green&label=@next-auth/upstash-redis-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/upstash-redis-adapter?color=green&label=@auth/upstash-redis-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/upstash-redis-adapter">
|
<a href="https://www.npmtrends.com/@auth/upstash-redis-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/upstash-redis-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/upstash-redis-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/upstash-redis-adapter",
|
"name": "@auth/upstash-redis-adapter",
|
||||||
"version": "3.0.4",
|
"version": "1.0.0",
|
||||||
"description": "Upstash adapter for next-auth. It uses Upstash's connectionless (HTTP based) Redis client.",
|
"description": "Upstash adapter for Auth.js.",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "github.com/kay-is",
|
"author": "github.com/kay-is",
|
||||||
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -25,13 +37,11 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
"dependencies": {
|
||||||
"README.md",
|
"@auth/core": "workspace:*"
|
||||||
"dist"
|
},
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@upstash/redis": "^1.0.1",
|
"@upstash/redis": "^1.0.1"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
@@ -43,9 +53,6 @@
|
|||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"next-auth": "workspace:*"
|
"next-auth": "workspace:*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"uuid": "^8.3.2"
|
|
||||||
},
|
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* npm install @upstash/redis @next-auth/upstash-redis-adapter
|
* npm install @upstash/redis @auth/upstash-redis-adapter
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/upstash-redis-adapter
|
* @module @auth/upstash-redis-adapter
|
||||||
*/
|
*/
|
||||||
import type {
|
import type {
|
||||||
Adapter,
|
Adapter,
|
||||||
@@ -20,11 +20,9 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import type { Redis } from "@upstash/redis"
|
import type { Redis } from "@upstash/redis"
|
||||||
|
|
||||||
import { v4 as uuid } from "uuid"
|
|
||||||
|
|
||||||
/** This is the interface of the Upstash Redis adapter options. */
|
/** This is the interface of the Upstash Redis adapter options. */
|
||||||
export interface UpstashRedisAdapterOptions {
|
export interface UpstashRedisAdapterOptions {
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +91,7 @@ export function hydrateDates(json: object) {
|
|||||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import GoogleProvider from "next-auth/providers/google"
|
* import GoogleProvider from "next-auth/providers/google"
|
||||||
* import { UpstashRedisAdapter } from "@next-auth/upstash-redis-adapter"
|
* import { UpstashRedisAdapter } from "@auth/upstash-redis-adapter"
|
||||||
* import upstashRedisClient from "@upstash/redis"
|
* import upstashRedisClient from "@upstash/redis"
|
||||||
*
|
*
|
||||||
* const redis = upstashRedisClient(
|
* const redis = upstashRedisClient(
|
||||||
@@ -217,7 +215,7 @@ export function UpstashRedisAdapter(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
async createUser(user) {
|
async createUser(user) {
|
||||||
const id = uuid()
|
const id = crypto.randomUUID()
|
||||||
// TypeScript thinks the emailVerified field is missing
|
// TypeScript thinks the emailVerified field is missing
|
||||||
// but all fields are copied directly from user, so it's there
|
// but all fields are copied directly from user, so it's there
|
||||||
return await setUser(id, { ...user, id })
|
return await setUser(id, { ...user, id })
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { runBasicTests } from "@next-auth/adapter-test"
|
|||||||
import { hydrateDates, UpstashRedisAdapter } from "../src"
|
import { hydrateDates, UpstashRedisAdapter } from "../src"
|
||||||
import "dotenv/config"
|
import "dotenv/config"
|
||||||
|
|
||||||
|
globalThis.crypto ??= require("node:crypto").webcrypto
|
||||||
|
|
||||||
if (!process.env.UPSTASH_REDIS_URL || !process.env.UPSTASH_REDIS_KEY) {
|
if (!process.env.UPSTASH_REDIS_URL || !process.env.UPSTASH_REDIS_KEY) {
|
||||||
test("Skipping UpstashRedisAdapter tests, since required environment variables aren't available", () => {
|
test("Skipping UpstashRedisAdapter tests, since required environment variables aren't available", () => {
|
||||||
expect(true).toBe(true)
|
expect(true).toBe(true)
|
||||||
@@ -27,6 +29,7 @@ const client = new Redis({
|
|||||||
runBasicTests({
|
runBasicTests({
|
||||||
adapter: UpstashRedisAdapter(client, { baseKeyPrefix: "testApp:" }),
|
adapter: UpstashRedisAdapter(client, { baseKeyPrefix: "testApp:" }),
|
||||||
db: {
|
db: {
|
||||||
|
disconnect: client.flushdb,
|
||||||
async user(id: string) {
|
async user(id: string) {
|
||||||
const data = await client.get<object>(`testApp:user:${id}`)
|
const data = await client.get<object>(`testApp:user:${id}`)
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
@@ -48,7 +51,7 @@ runBasicTests({
|
|||||||
},
|
},
|
||||||
async verificationToken(where) {
|
async verificationToken(where) {
|
||||||
const data = await client.get<object>(
|
const data = await client.get<object>(
|
||||||
`testApp:user:token:${where.identifier}`
|
`testApp:user:token:${where.identifier}:${where.token}`
|
||||||
)
|
)
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
return hydrateDates(data)
|
return hydrateDates(data)
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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",
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@auth/sveltekit",
|
"name": "@auth/sveltekit",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"description": "Authentication for SvelteKit.",
|
"description": "Authentication for SvelteKit.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"authentication",
|
"authentication",
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export async function signIn<
|
|||||||
const data = await res.clone().json()
|
const data = await res.clone().json()
|
||||||
const error = new URL(data.url).searchParams.get("error")
|
const error = new URL(data.url).searchParams.get("error")
|
||||||
|
|
||||||
if (redirect || !isSupportingReturn || !error) {
|
if (redirect || !isSupportingReturn) {
|
||||||
// TODO: Do not redirect for Credentials and Email providers by default in next major
|
// TODO: Do not redirect for Credentials and Email providers by default in next major
|
||||||
window.location.href = data.url ?? callbackUrl
|
window.location.href = data.url ?? callbackUrl
|
||||||
// If url contains a hash, the browser does not reload the page. We reload manually
|
// If url contains a hash, the browser does not reload the page. We reload manually
|
||||||
|
|||||||
9
pnpm-lock.yaml
generated
9
pnpm-lock.yaml
generated
@@ -352,17 +352,18 @@ importers:
|
|||||||
|
|
||||||
packages/adapter-mongodb:
|
packages/adapter-mongodb:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
mongodb: ^5.1.0
|
mongodb: ^5.1.0
|
||||||
next-auth: workspace:*
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
mongodb: 5.1.0
|
mongodb: 5.1.0
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-neo4j:
|
packages/adapter-neo4j:
|
||||||
specifiers:
|
specifiers:
|
||||||
@@ -504,6 +505,7 @@ importers:
|
|||||||
|
|
||||||
packages/adapter-upstash-redis:
|
packages/adapter-upstash-redis:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@types/uuid': ^8.3.3
|
'@types/uuid': ^8.3.3
|
||||||
@@ -512,9 +514,8 @@ importers:
|
|||||||
isomorphic-fetch: 3.0.0
|
isomorphic-fetch: 3.0.0
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
next-auth: workspace:*
|
||||||
uuid: ^8.3.2
|
|
||||||
dependencies:
|
dependencies:
|
||||||
uuid: 8.3.2
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
|
|||||||
10
turbo.json
10
turbo.json
@@ -47,7 +47,7 @@
|
|||||||
"e2e": {
|
"e2e": {
|
||||||
"outputs": ["playwright-report/**"]
|
"outputs": ["playwright-report/**"]
|
||||||
},
|
},
|
||||||
"@next-auth/upstash-redis-adapter#test": {
|
"@auth/upstash-redis-adapter#test": {
|
||||||
"env": ["UPSTASH_REDIS_KEY", "UPSTASH_REDIS_URL"]
|
"env": ["UPSTASH_REDIS_KEY", "UPSTASH_REDIS_URL"]
|
||||||
},
|
},
|
||||||
"docs#dev": {
|
"docs#dev": {
|
||||||
@@ -60,13 +60,13 @@
|
|||||||
"@next-auth/fauna-adapter#build",
|
"@next-auth/fauna-adapter#build",
|
||||||
"@next-auth/firebase-adapter#build",
|
"@next-auth/firebase-adapter#build",
|
||||||
"@next-auth/mikro-orm-adapter#build",
|
"@next-auth/mikro-orm-adapter#build",
|
||||||
"@next-auth/mongodb-adapter#build",
|
"@auth/mongodb-adapter#build",
|
||||||
"@next-auth/neo4j-adapter#build",
|
"@next-auth/neo4j-adapter#build",
|
||||||
"@next-auth/pouchdb-adapter#build",
|
"@next-auth/pouchdb-adapter#build",
|
||||||
"@next-auth/sequelize-adapter#build",
|
"@next-auth/sequelize-adapter#build",
|
||||||
"@next-auth/supabase-adapter#build",
|
"@next-auth/supabase-adapter#build",
|
||||||
"@auth/typeorm-adapter#build",
|
"@auth/typeorm-adapter#build",
|
||||||
"@next-auth/upstash-redis-adapter#build",
|
"@auth/upstash-redis-adapter#build",
|
||||||
"@next-auth/xata-adapter#build",
|
"@next-auth/xata-adapter#build",
|
||||||
"^build",
|
"^build",
|
||||||
"next-auth#build"
|
"next-auth#build"
|
||||||
@@ -83,13 +83,13 @@
|
|||||||
"@next-auth/fauna-adapter#build",
|
"@next-auth/fauna-adapter#build",
|
||||||
"@next-auth/firebase-adapter#build",
|
"@next-auth/firebase-adapter#build",
|
||||||
"@next-auth/mikro-orm-adapter#build",
|
"@next-auth/mikro-orm-adapter#build",
|
||||||
"@next-auth/mongodb-adapter#build",
|
"@auth/mongodb-adapter#build",
|
||||||
"@next-auth/neo4j-adapter#build",
|
"@next-auth/neo4j-adapter#build",
|
||||||
"@next-auth/pouchdb-adapter#build",
|
"@next-auth/pouchdb-adapter#build",
|
||||||
"@next-auth/sequelize-adapter#build",
|
"@next-auth/sequelize-adapter#build",
|
||||||
"@next-auth/supabase-adapter#build",
|
"@next-auth/supabase-adapter#build",
|
||||||
"@auth/typeorm-adapter#build",
|
"@auth/typeorm-adapter#build",
|
||||||
"@next-auth/upstash-redis-adapter#build",
|
"@auth/upstash-redis-adapter#build",
|
||||||
"@next-auth/xata-adapter#build",
|
"@next-auth/xata-adapter#build",
|
||||||
"^build",
|
"^build",
|
||||||
"next-auth#build"
|
"next-auth#build"
|
||||||
|
|||||||
Reference in New Issue
Block a user