Compare commits

...

16 Commits

Author SHA1 Message Date
Thang Vu
98782a6a9b Update release.yml 2023-07-26 23:30:16 +07:00
Thang Vu
e9fefaad11 pin different turbo version 2023-07-26 23:08:13 +07:00
Steven Yung
c0f9af4c56 docs: fix GitHub star counter position (#8143) 2023-07-26 15:04:12 +02:00
Balázs Orbán
c7b36f45a3 docs: update nodemailer link
Fixes #8141
2023-07-26 14:57:22 +02:00
Thang Vu
68ff69f9eb chore: upload turbo cache (#8128)
* Update index.ts

* Revert "Update index.ts"

This reverts commit f494291c7385d50e5e8cba65258893925808fa43.

* try this

* Update release.yml

* Update release.yml

* try

* Update turbo.json

* Update release.yml

* Update README.md

* Revert "Update README.md"

This reverts commit a5e56687e0bb60fcefb6c7a2f36d7135fb365e61.

* Update pnpm-workspace.yaml
2023-07-25 22:31:20 +07:00
Thang Vu
23c0a393da chore: add summarize flag for test 2023-07-24 23:31:31 +07:00
Thang Vu
f130f62a91 chore: ignore apps in test 2023-07-24 20:19:45 +07:00
Thang Vu
c111b436d2 chore: update turbo configurations 2023-07-24 19:39:06 +07:00
Thang Vu
ea895b8864 chore: add TURBO env vars back 2023-07-24 19:20:31 +07:00
Thang Vu
cfedc3b1a3 chore: bump next in dev 2023-07-24 19:01:12 +07:00
Thang Vu
287a5fc05a chore: clean up dev & lock file 2023-07-24 19:00:26 +07:00
Thang Vu
f3ad659e91 chore: remove TURBO env vars 2023-07-24 18:52:25 +07:00
Thang Vu
48b9a0203e chore: dev environment clean up 2023-07-23 14:13:31 +07:00
Thang Vu
39fbccb783 fix: follow up allow EndpointRequest to return void type 2023-07-23 14:10:46 +07:00
Junseo
f207e94146 fix(ts): allow EndpointRequest to return void type (#8112)
* fix: fix: enable EndpointRequest type to return void type

* Update packages/next-auth/src/providers/oauth.ts

* Update packages/core/src/providers/oauth.ts

---------

Co-authored-by: Thang Vu <hi@thvu.dev>
2023-07-22 23:05:29 +07:00
Serdar ŞEN
b845729cdb docs: update getting started commands for docs (#8040)
Co-authored-by: Thang Vu <hi@thvu.dev>
2023-07-22 12:53:03 +07:00
13 changed files with 1068 additions and 6692 deletions

View File

@@ -8,6 +8,10 @@ on:
- next - next
- 3.x - 3.x
pull_request: pull_request:
paths-ignore:
- ".vscode/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
# TODO: Support latest releases # TODO: Support latest releases
workflow_dispatch: workflow_dispatch:
inputs: inputs:
@@ -56,6 +60,8 @@ on:
- "adapter-upstash-redis" - "adapter-upstash-redis"
- "adapter-xata" - "adapter-xata"
- "next-auth" - "next-auth"
env:
FORCE_COLOR: true
jobs: jobs:
test: test:
@@ -75,6 +81,11 @@ jobs:
cache: "pnpm" cache: "pnpm"
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install
- name: Build
run: pnpm build
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
- name: Run tests - name: Run tests
run: pnpm test run: pnpm test
timeout-minutes: 15 timeout-minutes: 15
@@ -83,6 +94,11 @@ jobs:
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }} UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
- name: Upload Turbo artifacts
uses: actions/upload-artifact@v3
with:
name: turbo-report
path: .turbo/runs/
# - name: Run E2E tests # - name: Run E2E tests
# if: github.repository == 'nextauthjs/next-auth' # if: github.repository == 'nextauthjs/next-auth'
# run: pnpm e2e # run: pnpm e2e

View File

@@ -22,7 +22,7 @@
"@prisma/client": "^3", "@prisma/client": "^3",
"@supabase/supabase-js": "^2.0.5", "@supabase/supabase-js": "^2.0.5",
"faunadb": "^4", "faunadb": "^4",
"next": "13.3.0", "next": "13.4.0",
"next-auth": "workspace:*", "next-auth": "workspace:*",
"nodemailer": "^6", "nodemailer": "^6",
"react": "^18", "react": "^18",

View File

@@ -2,11 +2,11 @@ import { Auth, type AuthConfig } from "@auth/core"
// Providers // Providers
import Apple from "@auth/core/providers/apple" import Apple from "@auth/core/providers/apple"
import Asgardeo from "@auth/core/providers/asgardeo" // import Asgardeo from "@auth/core/providers/asgardeo"
import Auth0 from "@auth/core/providers/auth0" import Auth0 from "@auth/core/providers/auth0"
import AzureAD from "@auth/core/providers/azure-ad" import AzureAD from "@auth/core/providers/azure-ad"
import AzureB2C from "@auth/core/providers/azure-ad-b2c" import AzureB2C from "@auth/core/providers/azure-ad-b2c"
import BeyondIdentity from "@auth/core/providers/beyondidentity" // import BeyondIdentity from "@auth/core/providers/beyondidentity"
import BoxyHQSAML from "@auth/core/providers/boxyhq-saml" import BoxyHQSAML from "@auth/core/providers/boxyhq-saml"
// import Cognito from "@auth/core/providers/cognito" // import Cognito from "@auth/core/providers/cognito"
import Credentials from "@auth/core/providers/credentials" import Credentials from "@auth/core/providers/credentials"
@@ -86,8 +86,8 @@ export const authConfig: AuthConfig = {
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 }), Apple({ clientId: process.env.APPLE_ID, clientSecret: process.env.APPLE_SECRET as string }),
Asgardeo({ clientId: process.env.ASGARDEO_CLIENT_ID, clientSecret: process.env.ASGARDEO_CLIENT_SECRET, issuer: process.env.ASGARDEO_ISSUER }), // Asgardeo({ clientId: process.env.ASGARDEO_CLIENT_ID, clientSecret: process.env.ASGARDEO_CLIENT_SECRET, issuer: process.env.ASGARDEO_ISSUER }),
Auth0({ clientId: process.env.AUTH0_ID, clientSecret: process.env.AUTH0_SECRET, issuer: process.env.AUTH0_ISSUER }), Auth0({ clientId: process.env.AUTH0_ID, clientSecret: process.env.AUTH0_SECRET, issuer: process.env.AUTH0_ISSUER }),
AzureAD({ AzureAD({
clientId: process.env.AZURE_AD_CLIENT_ID, clientId: process.env.AZURE_AD_CLIENT_ID,
@@ -95,11 +95,11 @@ export const authConfig: AuthConfig = {
tenantId: process.env.AZURE_AD_TENANT_ID, 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 }), AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
BeyondIdentity({ // BeyondIdentity({
clientId: process.env.BEYOND_IDENTITY_CLIENT_ID, // clientId: process.env.BEYOND_IDENTITY_CLIENT_ID,
clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET, // clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET,
issuer: process.env.BEYOND_IDENTITY_ISSUER, // issuer: process.env.BEYOND_IDENTITY_ISSUER,
}), // }),
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }), 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 }), // 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 }), Descope({ clientId: process.env.DESCOPE_ID, clientSecret: process.env.DESCOPE_SECRET }),
@@ -108,7 +108,7 @@ export const authConfig: AuthConfig = {
Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }), Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }),
Foursquare({ clientId: process.env.FOURSQUARE_ID, clientSecret: process.env.FOURSQUARE_SECRET }), Foursquare({ clientId: process.env.FOURSQUARE_ID, clientSecret: process.env.FOURSQUARE_SECRET }),
Freshbooks({ clientId: process.env.FRESHBOOKS_ID, clientSecret: process.env.FRESHBOOKS_SECRET }), Freshbooks({ clientId: process.env.FRESHBOOKS_ID, clientSecret: process.env.FRESHBOOKS_SECRET }),
GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET, redirectProxy: process.env.AUTH_REDIRECT_PROXY_URL }), GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET, redirectProxyUrl: process.env.AUTH_REDIRECT_PROXY_URL }),
Gitlab({ clientId: process.env.GITLAB_ID, clientSecret: process.env.GITLAB_SECRET }), Gitlab({ clientId: process.env.GITLAB_ID, clientSecret: process.env.GITLAB_SECRET }),
Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_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 }), // IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
@@ -117,7 +117,7 @@ export const authConfig: AuthConfig = {
Line({ clientId: process.env.LINE_ID, clientSecret: process.env.LINE_SECRET }), Line({ clientId: process.env.LINE_ID, clientSecret: process.env.LINE_SECRET }),
LinkedIn({ clientId: process.env.LINKEDIN_ID, clientSecret: process.env.LINKEDIN_SECRET }), LinkedIn({ clientId: process.env.LINKEDIN_ID, clientSecret: process.env.LINKEDIN_SECRET }),
Mailchimp({ clientId: process.env.MAILCHIMP_ID, clientSecret: process.env.MAILCHIMP_SECRET }), Mailchimp({ clientId: process.env.MAILCHIMP_ID, clientSecret: process.env.MAILCHIMP_SECRET }),
Notion({ clientId: process.env.NOTION_ID, clientSecret: process.env.NOTION_SECRET, redirectUri: process.env.NOTION_REDIRECT_URI }), Notion({ clientId: process.env.NOTION_ID, clientSecret: process.env.NOTION_SECRET, redirectUri: process.env.NOTION_REDIRECT_URI as string }),
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }), // 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 }), Osu({ clientId: process.env.OSU_CLIENT_ID, clientSecret: process.env.OSU_CLIENT_SECRET }),
Patreon({ clientId: process.env.PATREON_ID, clientSecret: process.env.PATREON_SECRET }), Patreon({ clientId: process.env.PATREON_ID, clientSecret: process.env.PATREON_SECRET }),
@@ -162,4 +162,4 @@ function AuthHandler(...args: any[]) {
export default AuthHandler(authConfig) export default AuthHandler(authConfig)
export const config = { runtime: "experimental-edge" } export const config = { runtime: "edge" }

View File

@@ -37,22 +37,31 @@ This documentation site is based on the [Docusaurus](https://docusaurus.io) fram
To start a local environment of this project, please do the following. To start a local environment of this project, please do the following.
1. Clone the repository. 1. Clone the repo:
```bash ```sh
$ git clone https://github.com/nextauthjs/docs.git git clone git@github.com:nextauthjs/next-auth.git
cd next-auth
``` ```
2. Install dependencies 2. Set up the correct pnpm version, using [Corepack](https://nodejs.org/api/corepack.html). Run the following in the project'a root:
```bash ```sh
$ npm install corepack enable pnpm
``` ```
3. Start the development server (Now, if you run `pnpm --version`, it should print the same verion as the `packageManager` property in the [`package.json` file](https://github.com/nextauthjs/next-auth/blob/main/package.json))
3. Install packages. Developing requires Node.js v18:
```sh
pnpm install
```
4. Start the development server
```bash ```bash
$ npm start $ pnpm dev:docs
``` ```
And thats all! Now you should have a local copy of this docs site running at [localhost:3000](http://localhost:3000)! And thats all! Now you should have a local copy of this docs site running at [localhost:3000](http://localhost:3000)!

View File

@@ -34,7 +34,7 @@ npm install -D nodemailer
## 2. Setting up a SMTP service ## 2. Setting up a SMTP service
Next we need a [SMTP service](https://sendgrid.com/blog/what-is-an-smtp-server/) which will be in charge of sending emails from our application. There's a number of services available for this, however [here are the ones](http://nodemailer.com/smtp/well-known/) known to work with `nodemailer`. Next we need a [SMTP service](https://sendgrid.com/blog/what-is-an-smtp-server/) which will be in charge of sending emails from our application. There's a number of services available for this, however [here are the ones](https://community.nodemailer.com/2-0-0-beta/setup-smtp/well-known-services) known to work with `nodemailer`.
:::info :::info
For this tutorial, we're going to be using [Sendgrid](https://sendgrid.com/), but any of the services linked above should work the same For this tutorial, we're going to be using [Sendgrid](https://sendgrid.com/), but any of the services linked above should work the same

View File

@@ -91,7 +91,7 @@ html[data-theme="dark"] .navbar__item.navbar__link[href*="npm"]:before {
position: absolute; position: absolute;
color: #000; color: #000;
top: -10px; top: -10px;
right: -45px; right: 4px;
font-size: 9px; font-size: 9px;
background-color: #ccc; background-color: #ccc;
padding: 2px 5px; padding: 2px 5px;

View File

@@ -101,13 +101,13 @@ export default function Home() {
.fetch("https://api.github.com/repos/nextauthjs/next-auth") .fetch("https://api.github.com/repos/nextauthjs/next-auth")
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((data) => {
const navLinks = document.getElementsByClassName( const githubLink = document.querySelector(
"navbar__item navbar__link" ".navbar__item.navbar__link[href*='github']"
) )
const githubStat = document.createElement("span") const githubStat = document.createElement("span")
githubStat.innerHTML = kFormatter(data.stargazers_count) githubStat.innerHTML = kFormatter(data.stargazers_count)
githubStat.className = "github-counter" githubStat.className = "github-counter"
navLinks[4].appendChild(githubStat) githubLink.appendChild(githubStat)
}) })
}, []) }, [])
return ( return (

View File

@@ -6,8 +6,8 @@
"scripts": { "scripts": {
"build:app": "turbo run build --filter=next-auth-app", "build:app": "turbo run build --filter=next-auth-app",
"build:docs": "turbo run build --filter=docs", "build:docs": "turbo run build --filter=docs",
"build": "turbo run build --filter=next-auth --filter=@next-auth/* --filter=@auth/* --no-deps", "build": "turbo run build --filter=next-auth --filter=@next-auth/* --filter=@auth/* --no-deps --summarize",
"test": "turbo run test --concurrency=1 --filter=[HEAD^1] --filter=./packages/* --filter=!@*upstash* --filter=!*dynamodb-*", "test": "turbo run test --concurrency=1 --summarize --filter=[HEAD^1] --filter=./packages/* --filter=!@*upstash* --filter=!*dynamodb-* --filter=!*app*",
"clean": "turbo run clean --no-cache", "clean": "turbo run clean --no-cache",
"dev:db": "turbo run dev --parallel --continue --filter=next-auth-app...", "dev:db": "turbo run dev --parallel --continue --filter=next-auth-app...",
"dev": "turbo run dev --parallel --continue --filter=next-auth-app... --filter=!./packages/adapter-*", "dev": "turbo run dev --parallel --continue --filter=next-auth-app... --filter=!./packages/adapter-*",
@@ -43,7 +43,7 @@
"eslint-plugin-svelte3": "^4.0.0", "eslint-plugin-svelte3": "^4.0.0",
"prettier": "2.8.1", "prettier": "2.8.1",
"prettier-plugin-svelte": "^2.8.1", "prettier-plugin-svelte": "^2.8.1",
"turbo": "1.10.1", "turbo": "1.10.3",
"typescript": "4.9.4" "typescript": "4.9.4"
}, },
"engines": { "engines": {

View File

@@ -122,7 +122,7 @@ export async function handleOAuth(
throw new Error("TODO: Handle www-authenticate challenges as needed") throw new Error("TODO: Handle www-authenticate challenges as needed")
} }
let profile: Profile let profile: Profile = {}
let tokens: TokenSet & Pick<Account, "expires_at"> let tokens: TokenSet & Pick<Account, "expires_at">
if (provider.type === "oidc") { if (provider.type === "oidc") {
@@ -153,7 +153,8 @@ export async function handleOAuth(
} }
if (userinfo?.request) { if (userinfo?.request) {
profile = await userinfo.request({ tokens, provider }) const _profile = await userinfo.request({ tokens, provider })
if (_profile instanceof Object) profile = _profile
} else if (userinfo?.url) { } else if (userinfo?.url) {
const userinfoResponse = await o.userInfoRequest( const userinfoResponse = await o.userInfoRequest(
as, as,

View File

@@ -31,7 +31,7 @@ type EndpointRequest<C, R, P> = (
callbackUrl: string callbackUrl: string
} }
} }
) => Awaitable<R> ) => Awaitable<R> | void
/** Gives granular control of the request to the given endpoint */ /** Gives granular control of the request to the given endpoint */
interface AdvancedEndpointHandler<P extends UrlParams, C, R> { interface AdvancedEndpointHandler<P extends UrlParams, C, R> {

7654
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
packages: packages:
- "packages/*" - "packages/*"
- "apps/dev/*" - "apps/dev/*"
- "apps/playgrounds/*"
- "docs" - "docs"

View File

@@ -3,7 +3,8 @@
"pipeline": { "pipeline": {
"build": { "build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
"outputs": ["dist/**/*", "*.js", "*.d.ts", "*.d.ts.map"] "outputs": ["dist/**/*", "*.js", "*.d.ts", "*.d.ts.map"],
"outputMode": "new-only"
}, },
"next-auth#build": { "next-auth#build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
@@ -17,7 +18,8 @@
"react/**", "react/**",
"*.js", "*.js",
"*.d.ts" "*.d.ts"
] ],
"outputMode": "new-only"
}, },
"@auth/core#build": { "@auth/core#build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
@@ -29,11 +31,13 @@
"*.d.ts.map", "*.d.ts.map",
"src/lib/pages/styles.ts", "src/lib/pages/styles.ts",
"src/providers/oauth-types.ts" "src/providers/oauth-types.ts"
] ],
"outputMode": "new-only"
}, },
"@auth/sveltekit#build": { "@auth/sveltekit#build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
"outputs": [".svelte-kit/**", "client.*", "index.*"] "outputs": [".svelte-kit/**", "client.*", "index.*"],
"outputMode": "new-only"
}, },
"clean": { "clean": {
"cache": false "cache": false
@@ -42,7 +46,7 @@
"cache": false "cache": false
}, },
"test": { "test": {
"outputs": [] "outputMode": "new-only"
}, },
"e2e": { "e2e": {
"outputs": ["playwright-report/**"] "outputs": ["playwright-report/**"]