Skip to content

Commit

Permalink
Merge branch 'main' into feat/testing-core
Browse files Browse the repository at this point in the history
  • Loading branch information
ThangHuuVu authored Nov 28, 2023
2 parents 3e54ee4 + 0126f94 commit f1692d7
Show file tree
Hide file tree
Showing 40 changed files with 260 additions and 128 deletions.
13 changes: 1 addition & 12 deletions apps/dev/nextjs/app/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import { handlers } from "auth"
const { GET: AuthGET, POST } = handlers
export { POST }

import type { NextRequest } from "next/server"

// Showcasing advanced initialization in Route Handlers
export async function GET(request: NextRequest) {
// Do something with request
const response = await AuthGET(request)
// Do something with response
return response
}
export const { GET, POST } = handlers

// export const runtime = "edge"
5 changes: 1 addition & 4 deletions apps/examples/nextjs/components/auth-components.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { signIn, signOut } from "auth"
import { Button } from "./ui/button"
import { redirect } from "next/navigation"

export function SignIn({
provider,
Expand All @@ -10,9 +9,7 @@ export function SignIn({
<form
action={async () => {
"use server"
const url = await signIn(provider, { redirect: false })
// TODO: fix in next-auth
redirect(url.replace("signin", "api/auth/signin"))
await signIn(provider)
}}
>
<Button {...props}>Sign In</Button>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/basics/callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The redirect callback may be invoked more than once in the same flow.
This callback is called whenever a JSON Web Token is created (i.e. at sign
in) or updated (i.e whenever a session is accessed in the client). The returned value will be [encrypted](/reference/core#authconfig#jwt), and it is stored in a cookie.

Requests to `/api/auth/signin`, `/api/auth/session` and calls to `getSession()`, `unstable_getServerSession()`, `useSession()` will invoke this function, but only if you are using a [JWT session](/reference/core#authconfig#session). This method is not invoked when you persist sessions in a database.
Requests to `/api/auth/signin`, `/api/auth/session` and calls to `getSession()`, `getServerSession()`, `useSession()` will invoke this function, but only if you are using a [JWT session](/reference/core#authconfig#session). This method is not invoked when you persist sessions in a database.

- As with database persisted session expiry times, token expiry time is extended whenever a session is active.
- The arguments _user_, _account_, _profile_ and _isNewUser_ are only passed the first time this callback is called on a new session, after the user signs in. In subsequent calls, only `token` will be available.
Expand Down
14 changes: 7 additions & 7 deletions docs/docs/guides/upgrade-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ See the table below for a summary of the changes, and click on the links to lear

| Where | v4 | v5 |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------- | -------------------------------- |
| [Server Component](?authentication-method=server-component#authenticate-methods) | `getServerSession(authOptions)` | `auth()` call |
| [Middleware](?authentication-method=middleware#authenticate-methods) | `withAuth(middleware, subset of authOptions)` wrapper | `auth` export / `auth()` wrapper |
| [Client Component](?authentication-method=client-component#authenticate-methods) | `useSession()` hook | `useSession()` hook |
| [Server Component](/reference/nextjs#in-server-components) | `getServerSession(authOptions)` | `auth()` call |
| [Middleware](/reference/nextjs#in-middleware) | `withAuth(middleware, subset of authOptions)` wrapper | `auth` export / `auth()` wrapper |
| [Client Component](/reference/nextjs/react#usesession) | `useSession()` hook | `useSession()` hook |
| [Route Handler](/reference/nextjs#in-route-handlers) | _Previously not supported_ | `auth()` wrapper |
| [API Route (Edge)](/reference/nextjs#in-edge-api-routes) | _Previously not supported_ | `auth()` wrapper |
| [API Route (Node.js)](?authentication-method=api-route#authenticate-methods) | `getServerSession(req, res, authOptions)` | `auth(req, res)` call |
| [API Route (Node.js)](?authentication-method=api-route#authenticate-methods) | `getToken(req)` (No session rotation) | `auth(req, res)` call |
| [getServerSideProps](?authentication-method=get-serverside-props#authenticate-methods) | `getServerSession(ctx.req, ctx.res, authOptions)` | `auth(ctx)` call |
| [getServerSideProps](?authentication-method=get-serverside-props#authenticate-methods) | `getToken(ctx.req)` (No session rotation) | `auth(req, res)` call |
| [API Route (Node.js)](/reference/nextjs#in-api-routes) | `getServerSession(req, res, authOptions)` | `auth(req, res)` call |
| [API Route (Node.js)](/reference/nextjs#in-api-routes) | `getToken(req)` (No session rotation) | `auth(req, res)` call |
| [getServerSideProps](/reference/nextjs#in-getserversideprops) | `getServerSession(ctx.req, ctx.res, authOptions)` | `auth(ctx)` call |
| [getServerSideProps](/reference/nextjs#in-api-routes) | `getToken(ctx.req)` (No session rotation) | `auth(req, res)` call |

### Authentication methods

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-azure-tables/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/azure-tables-adapter",
"version": "0.1.7",
"version": "0.1.8",
"description": "Azure Tables Storage adapter for next-auth.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-d1/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/d1-adapter",
"version": "0.2.6",
"version": "0.2.7",
"description": "A Cloudflare D1 adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-dgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/dgraph-adapter",
"version": "1.0.6",
"version": "1.0.7",
"description": "Dgraph adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-drizzle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/drizzle-adapter",
"version": "0.3.8",
"version": "0.3.9",
"description": "Drizzle adapter for Auth.js.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-dynamodb/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@auth/dynamodb-adapter",
"repository": "https://github.com/nextauthjs/next-auth",
"version": "1.0.8",
"version": "1.0.9",
"description": "AWS DynamoDB adapter for next-auth.",
"keywords": [
"next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-edgedb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/edgedb-adapter",
"version": "0.2.6",
"version": "0.2.7",
"description": "EdgeDB adapter for next-auth.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-fauna/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/fauna-adapter",
"version": "1.0.6",
"version": "1.0.7",
"description": "Fauna Adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-firebase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/firebase-adapter",
"version": "1.0.6",
"version": "1.0.7",
"description": "Firebase adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-hasura/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/hasura-adapter",
"version": "0.2.7",
"version": "0.2.8",
"description": "Hasura adapter for Auth.js.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-kysely/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/kysely-adapter",
"version": "0.1.7",
"version": "0.1.8",
"description": "Kysely adapter for Auth.js",
"homepage": "https://authjs.dev/reference/adapter/kysely",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-mikro-orm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/mikro-orm-adapter",
"version": "1.0.7",
"version": "1.0.8",
"description": "MikroORM adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-mongodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/mongodb-adapter",
"version": "2.0.6",
"version": "2.0.7",
"description": "MongoDB adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-neo4j/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/neo4j-adapter",
"version": "1.0.6",
"version": "1.0.7",
"description": "neo4j adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-pg/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/pg-adapter",
"version": "0.2.6",
"version": "0.2.7",
"description": "Postgres adapter for next-auth.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-pouchdb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/pouchdb-adapter",
"version": "1.0.6",
"version": "1.0.7",
"description": "PouchDB adapter for next-auth.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-prisma/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/prisma-adapter",
"version": "1.0.8",
"version": "1.0.9",
"description": "Prisma adapter for Auth.js",
"homepage": "https://authjs.dev/reference/adapter/prisma",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-sequelize/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/sequelize-adapter",
"version": "1.0.8",
"version": "1.0.9",
"description": "Sequelize adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-supabase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/supabase-adapter",
"version": "0.1.9",
"version": "0.1.10",
"description": "Supabase adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-surrealdb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/surrealdb-adapter",
"version": "0.2.2",
"version": "0.2.3",
"description": "SurrealDB adapter for next-auth.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-typeorm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/typeorm-adapter",
"version": "1.0.9",
"version": "1.0.10",
"description": "TypeORM adapter for Auth.js.",
"homepage": "https://authjs.dev/reference/adapter/typeorm",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-upstash-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/upstash-redis-adapter",
"version": "1.0.7",
"version": "1.0.8",
"description": "Upstash adapter for Auth.js.",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-xata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/xata-adapter",
"version": "0.1.6",
"version": "0.1.7",
"description": "Xata adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auth/core",
"version": "0.18.3",
"version": "0.18.4",
"description": "Authentication for the Web.",
"keywords": [
"authentication",
Expand Down Expand Up @@ -62,7 +62,7 @@
"license": "ISC",
"dependencies": {
"@panva/hkdf": "^1.1.1",
"cookie": "0.5.0",
"cookie": "0.6.0",
"jose": "^5.1.0",
"oauth4webapi": "^2.3.0",
"preact": "10.11.3",
Expand All @@ -85,7 +85,7 @@
"providers": "node scripts/generate-providers"
},
"devDependencies": {
"@types/cookie": "0.5.1",
"@types/cookie": "0.6.0",
"@types/node": "18.11.10",
"@types/nodemailer": "6.4.6",
"@types/react": "18.0.37",
Expand Down
Loading

0 comments on commit f1692d7

Please sign in to comment.