Skip to content

Commit

Permalink
Merge branch 'main' into chore/improve-oauth-section
Browse files Browse the repository at this point in the history
  • Loading branch information
halvaradop authored Nov 30, 2024
2 parents cca16e6 + 2922e28 commit 52f2315
Show file tree
Hide file tree
Showing 204 changed files with 5,733 additions and 4,732 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/2_bug_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ body:
- "42 School"
- "Apple"
- "Asgardeo"
- "Atlassian"
- "Auth0"
- "Authentik"
- "Azure Active Directory"
Expand Down Expand Up @@ -60,6 +61,7 @@ body:
- "Kinde"
- "Line"
- "LinkedIn"
- "Loops"
- "Mailchimp"
- "Mail.ru"
- "Mastodon"
Expand Down
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
versioning-strategy: "increase"
allow:
- dependency-name: "oauth4webapi"
- dependency-name: "jose"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
run: cd apps/examples/nextjs-docker && pnpm test:docker
- name: Run E2E tests
continue-on-error: true # TODO: Make this less flakey
if: github.repository == 'nextauthjs/next-auth'
if: ${{ env.PACKAGES_CHANGES == 'true' || github.ref == 'refs/heads/main' }}
timeout-minutes: 15
env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ docs/.next
docs/manifest.mjs

# Core
packages/core/src/providers/oauth-types.ts
packages/core/src/providers/provider-types.ts
packages/core/lib
packages/core/providers
packages/core/src/lib/pages/styles.ts
Expand Down
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ packages/**/*.js
!packages/*/scripts/*.js

# @auth/core
packages/core/src/providers/oauth-types.ts
packages/core/src/providers/provider-types.ts
packages/core/src/lib/pages/styles.ts

# @auth/sveltekit
Expand All @@ -43,7 +43,7 @@ packages/frameworks-sveltekit/vite.config.{js,ts}.timestamp-*
packages/frameworks-express/providers

# next-auth
packages/next-auth/src/providers/oauth-types.ts
packages/next-auth/src/providers/provider-types.ts
packages/next-auth/css/index.css

# Adapters
Expand Down
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
<p align="center">Authentication for the Web.</p>
<p align="center">Open Source. Full Stack. Own Your Data.</p>
<p align="center" style="align: center;">
<a href="https://x.com/authjs" ><img src="https://shields.io/badge/Follow @authjs-000?logo=x&style=flat-square" alt="X (formerly known Twitter)" /></a>
<a href="https://github.com/nextauthjs/next-auth/releases"><img src="https://img.shields.io/npm/v/next-auth/latest?style=flat-square&label=latest%20stable" alt="NPM next-auth@latest release" /></a>
<a href="https://github.com/nextauthjs/next-auth/releases"><img src="https://img.shields.io/npm/v/next-auth/beta?style=flat-square&label=latest%20v5" alt="NPM next-auth@beta release" /></a>
<a href="https://github.com/nextauthjs/next-auth/releases"><img src="https://img.shields.io/npm/v/next-auth/beta?style=flat-square&label=latest%20NextAuth.js v5" alt="NPM next-auth@beta release" /></a>
<!-- TODO: Should count `@auth/core` when NextAuth.js v5 is released as stable. -->
<a href="https://www.npmtrends.com/next-auth"><img src="https://img.shields.io/npm/dm/next-auth?style=flat-square&color=cyan" 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&color=orange" alt="Github Stars" /></a>
<a href="https://codecov.io/gh/nextauthjs/next-auth" ><img alt="Codecov" src="https://img.shields.io/codecov/c/github/nextauthjs/next-auth?token=o2KN5GrPsY&style=flat-square&logo=codecov"></a>
<!-- <a href="https://codecov.io/gh/nextauthjs/next-auth" ><img alt="Codecov" src="https://img.shields.io/codecov/c/github/nextauthjs/next-auth?token=o2KN5GrPsY&style=flat-square&logo=codecov"></a> -->
<img src="https://shields.io/badge/TypeScript-3178C6?logo=TypeScript&logoColor=fff&style=flat-square" alt="TypeScript" />
</p>
<p align="center">
Expand Down Expand Up @@ -107,13 +108,6 @@ We have an [OpenCollective](https://opencollective.com/nextauth) for companies a
<div>FusionAuth</div>
<sub>💵</sub>
</td>
<td align="center" valign="top">
<a href="https://www.beyondidentity.com" target="_blank">
<img height="96" src="https://avatars.githubusercontent.com/u/69811361?s=200&v=4" alt="Beyond Identity Logo" />
</a><br />
<div>Beyond Identity</div>
<sub>💵</sub>
</td>
<td align="center" valign="top">
<a href="https://stytch.com" target="_blank">
<img height="96" src="https://avatars.githubusercontent.com/u/69983493?s=200&v=4" alt="Stytch Logo" />
Expand All @@ -128,8 +122,22 @@ We have an [OpenCollective](https://opencollective.com/nextauth) for companies a
<div>Prisma</div>
<sub>💵</sub>
</td>
<td align="center" valign="top">
<a href="https://neon.tech" target="_blank">
<img height="96" src="https://avatars.githubusercontent.com/u/77690634?v=4" alt="Neon Logo" />
</a><br />
<div>Neon</div>
<sub>💵</sub>
</td>
</tr>
<tr>
<td align="center" valign="top">
<a href="https://www.beyondidentity.com" target="_blank">
<img height="96" src="https://avatars.githubusercontent.com/u/69811361?s=200&v=4" alt="Beyond Identity Logo" />
</a><br />
<div>Beyond Identity</div>
<sub>💵</sub>
</td>
<td align="center" valign="top">
<a href="https://lowdefy.com" target="_blank">
<img height="96" src="https://avatars.githubusercontent.com/u/47087496?s=200&v=4" alt="Lowdefy Logo" />
Expand Down Expand Up @@ -158,6 +166,15 @@ We have an [OpenCollective](https://opencollective.com/nextauth) for companies a
<div>Encore</div>
<sub>💵</sub>
</td>
<td align="center" valign="top">
<a href="https://sent.dm/?ref=auth.js" target="_blank">
<img width="108" src="https://avatars.githubusercontent.com/u/153308555?v=4" alt="Sent.dm Logo" />
</a><br />
<div>Sent.dm</div>
<sub>💵</sub>
</td>
</tr>
<tr>
<td align="center" valign="top">
<a href="https://arcjet.com/?ref=auth.js" target="_blank">
<img width="108" src="https://avatars.githubusercontent.com/u/24397786?s=200&v=4" alt="Arcjet Logo" />
Expand All @@ -172,8 +189,6 @@ We have an [OpenCollective](https://opencollective.com/nextauth) for companies a
<div>Route4Me</div>
<sub>💵</sub>
</td>
</tr>
<tr>
<td align="center" valign="top">
<a href="https://www.netlight.com/" target="_blank">
<img height="96" src="https://avatars.githubusercontent.com/u/1672348?s=200&v=4" alt="Netlight logo" />
Expand Down
2 changes: 1 addition & 1 deletion apps/dev/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "MIT",
"dependencies": {
"@auth/express": "workspace:*",
"express": "^4.19.2",
"express": "^4.20.0",
"morgan": "^1.10.0",
"pug": "^3.0.2"
},
Expand Down
6 changes: 5 additions & 1 deletion apps/dev/nextjs/app/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export default function Client() {
) : (
<>
<button onClick={() => signIn("github")}>Sign in GitHub</button>
<button onClick={() => signIn("credentials", {})}>
<button
onClick={async () => {
await signIn("webauthn", {})
}}
>
Sign in Credentials
</button>
</>
Expand Down
4 changes: 3 additions & 1 deletion apps/dev/nextjs/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import NextAuth from "next-auth"
import type { NextAuthConfig } from "next-auth"
import Credentials from "next-auth/providers/credentials"
import Keycloak from "next-auth/providers/keycloak"
import GitHub from "next-auth/providers/github"

// import { PrismaClient } from "@prisma/client"
// import { PrismaAdapter } from "@auth/prisma-adapter"
Expand Down Expand Up @@ -66,8 +66,10 @@ export const { handlers, auth, signIn, signOut, unstable_update } = NextAuth({
}
},
}),
GitHub,
Keycloak,
],

callbacks: {
jwt({ token, trigger, session }) {
if (trigger === "update") token.name = session.user.name
Expand Down
2 changes: 1 addition & 1 deletion apps/dev/nextjs/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion apps/dev/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"license": "ISC",
"dependencies": {
"next": "15.0.0-canary.144",
"next": "15.0.0-rc.1",
"next-auth": "workspace:*",
"react": "19.0.0-rc-4c58fce7-20240904",
"react-dom": "19.0.0-rc-4c58fce7-20240904"
Expand Down
32 changes: 12 additions & 20 deletions apps/examples/nextjs/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import NextAuth from "next-auth"
import "next-auth/jwt"

import Apple from "next-auth/providers/apple"
// import Atlassian from "next-auth/providers/atlassian"
import Auth0 from "next-auth/providers/auth0"
import AzureB2C from "next-auth/providers/azure-ad-b2c"
import BankIDNorway from "next-auth/providers/bankid-no"
Expand All @@ -17,6 +18,7 @@ import Google from "next-auth/providers/google"
import Hubspot from "next-auth/providers/hubspot"
import Keycloak from "next-auth/providers/keycloak"
import LinkedIn from "next-auth/providers/linkedin"
import MicrosoftEntraId from "next-auth/providers/microsoft-entra-id"
import Netlify from "next-auth/providers/netlify"
import Okta from "next-auth/providers/okta"
import Passage from "next-auth/providers/passage"
Expand All @@ -35,7 +37,6 @@ import { createStorage } from "unstorage"
import memoryDriver from "unstorage/drivers/memory"
import vercelKVDriver from "unstorage/drivers/vercel-kv"
import { UnstorageAdapter } from "@auth/unstorage-adapter"
import type { NextAuthConfig } from "next-auth"

const storage = createStorage({
driver: process.env.VERCEL
Expand All @@ -47,17 +48,15 @@ const storage = createStorage({
: memoryDriver(),
})

const config = {
export const { handlers, auth, signIn, signOut } = NextAuth({
debug: !!process.env.AUTH_DEBUG,
theme: { logo: "https://authjs.dev/img/logo-sm.png" },
adapter: UnstorageAdapter(storage),
providers: [
Apple,
// Atlassian,
Auth0,
AzureB2C({
clientId: process.env.AUTH_AZURE_AD_B2C_ID,
clientSecret: process.env.AUTH_AZURE_AD_B2C_SECRET,
issuer: process.env.AUTH_AZURE_AD_B2C_ISSUER,
}),
AzureB2C,
BankIDNorway,
BoxyHQSAML({
clientId: "dummy",
Expand All @@ -75,6 +74,7 @@ const config = {
Hubspot,
Keycloak({ name: "Keycloak (bob/bob)" }),
LinkedIn,
MicrosoftEntraId,
Netlify,
Okta,
Passkey({
Expand All @@ -97,9 +97,7 @@ const config = {
Vipps({
issuer: "https://apitest.vipps.no/access-management-1.0/access/",
}),
WorkOS({
connection: process.env.AUTH_WORKOS_CONNECTION!,
}),
WorkOS({ connection: process.env.AUTH_WORKOS_CONNECTION! }),
Zoom,
],
basePath: "/auth",
Expand All @@ -118,19 +116,13 @@ const config = {
return token
},
async session({ session, token }) {
if (token?.accessToken) {
session.accessToken = token.accessToken
}
if (token?.accessToken) session.accessToken = token.accessToken

return session
},
},
experimental: {
enableWebAuthn: true,
},
debug: process.env.NODE_ENV !== "production" ? true : false,
} satisfies NextAuthConfig

export const { handlers, auth, signIn, signOut } = NextAuth(config)
experimental: { enableWebAuthn: true },
})

declare module "next-auth" {
interface Session {
Expand Down
8 changes: 3 additions & 5 deletions apps/proxy/api/[auth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Google from "@auth/core/providers/google"
import Hubspot from "@auth/core/providers/hubspot"
import Keycloak from "@auth/core/providers/keycloak"
import LinkedIn from "@auth/core/providers/linkedin"
import MicrosoftEntraId from "@auth/core/providers/microsoft-entra-id"
import Netlify from "@auth/core/providers/netlify"
import Okta from "@auth/core/providers/okta"
import Passage from "@auth/core/providers/passage"
Expand All @@ -33,11 +34,7 @@ const authConfig: AuthConfig = {
providers: [
Apple,
Auth0,
AzureB2C({
clientId: process.env.AUTH_AZURE_AD_B2C_ID,
clientSecret: process.env.AUTH_AZURE_AD_B2C_SECRET,
issuer: process.env.AUTH_AZURE_AD_B2C_ISSUER,
}),
AzureB2C,
BankId,
BoxyHQSAML({
clientId: "dummy",
Expand All @@ -55,6 +52,7 @@ const authConfig: AuthConfig = {
Hubspot,
Keycloak,
LinkedIn,
MicrosoftEntraId,
Netlify,
Okta,
Passage,
Expand Down
18 changes: 0 additions & 18 deletions docs/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,6 @@ export function Footer({ className = "" }) {
Discord Community
</a>
</li>
<li>
<a
className="flex items-center gap-1 text-current"
target="_blank"
rel="noopener noreferrer"
title="vercel.com homepage"
href="https://vercel.com?utm_source=authjs&utm_campaign=oss"
>
<span>Powered by</span>
<svg height={20} viewBox="0 0 283 64" fill="none">
<title>Vercel</title>
<path
fill="currentColor"
d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z"
/>
</svg>
</a>
</li>
</ul>
</div>
<div className="flex flex-col">
Expand Down
Loading

0 comments on commit 52f2315

Please sign in to comment.