-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add Preview Deployment example * simplify package.json * chore(examples): bump to `next-auth@beta`
- Loading branch information
1 parent
4f31135
commit 0ba1d41
Showing
7 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
VERCEL="1" | ||
# https://vercel.com/changelog/corepack-experimental-is-now-available | ||
ENABLE_EXPERIMENTAL_COREPACK="1" | ||
|
||
# https://authjs.dev/getting-started/deployment#securing-a-preview-deployment | ||
AUTH_SECRET= # openssl rand -base64 64 | ||
AUTH_GITHUB_ID= | ||
AUTH_GITHUB_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# dependencies | ||
/node_modules | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Auth, AuthConfig } from "@auth/core" | ||
import GitHub from "@auth/core/providers/github" | ||
|
||
export default function handler(req: Request) { | ||
return Auth(req, getDefaults({ providers: [GitHub] })) | ||
} | ||
|
||
export const config = { runtime: "edge" } | ||
|
||
export function getDefaults(config: AuthConfig) { | ||
config.secret ??= process.env.AUTH_SECRET | ||
config.trustHost ??= !!process.env.VERCEL | ||
config.redirectProxyUrl ??= process.env.AUTH_REDIRECT_PROXY_URL | ||
config.providers = config.providers.map((p) => { | ||
const finalProvider = typeof p === "function" ? p() : p | ||
if (finalProvider.type === "oauth" || finalProvider.type === "oidc") { | ||
const ID = finalProvider.id.toUpperCase() | ||
finalProvider.clientId ??= process.env[`AUTH_${ID}_ID`] | ||
finalProvider.clientSecret ??= process.env[`AUTH_${ID}_SECRET`] | ||
if (finalProvider.type === "oidc") { | ||
finalProvider.issuer ??= process.env[`AUTH_${ID}_ISSUER`] | ||
} | ||
} | ||
return finalProvider | ||
}) | ||
return config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default } from "../[auth].js" | ||
export const config = { runtime: "edge" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "proxy", | ||
"description": "Proxy for Auth.js hosted examples", | ||
"private": true, | ||
"type": "module", | ||
"dependencies": { | ||
"@auth/core": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"**/*.ts", | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
] | ||
} |
0ba1d41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
auth-docs – ./docs
authjs.dev
next-auth-docs-m1mt.vercel.app
providers.authjs.dev
auth-docs-authjs.vercel.app
errors.authjs.dev
warnings.authjs.dev
www.authjs.dev
nextjs.authjs.dev
sveltekit.authjs.dev
adapters.authjs.dev
auth-docs-git-main-authjs.vercel.app