Update .env.example comments (#90)
This commit is contained in:
commit
90180705e4
2 changed files with 5 additions and 6 deletions
|
|
@ -9,8 +9,8 @@ AUTH_SECRET=XXXXXXXX
|
||||||
AUTH_GITHUB_ID=XXXXXXXX
|
AUTH_GITHUB_ID=XXXXXXXX
|
||||||
AUTH_GITHUB_SECRET=XXXXXXXX
|
AUTH_GITHUB_SECRET=XXXXXXXX
|
||||||
# Support OAuth login on preview deployments, see: https://authjs.dev/guides/basics/deployment#securing-a-preview-deployment
|
# Support OAuth login on preview deployments, see: https://authjs.dev/guides/basics/deployment#securing-a-preview-deployment
|
||||||
# Set the following only when deployed. We recommend using a different OAuth app for development/production.
|
# Set the following only when deployed. In this example, we can reuse the same OAuth app, but if you are storing users, we recommend using a different OAuth app for development/production so that you don't mix your test and production user base.
|
||||||
# AUTH_REDIRECT_PROXY_URL=https://auth.example.com/api/auth
|
# AUTH_REDIRECT_PROXY_URL=https://YOURAPP.vercel.app/api/auth
|
||||||
|
|
||||||
# Instructions to create kv database here: https://vercel.com/docs/storage/vercel-kv/quickstart and
|
# Instructions to create kv database here: https://vercel.com/docs/storage/vercel-kv/quickstart and
|
||||||
KV_URL=XXXXXXXX
|
KV_URL=XXXXXXXX
|
||||||
|
|
|
||||||
7
auth.ts
7
auth.ts
|
|
@ -1,6 +1,5 @@
|
||||||
import NextAuth, { type DefaultSession } from 'next-auth'
|
import NextAuth, { type DefaultSession } from 'next-auth'
|
||||||
import GitHub from 'next-auth/providers/github'
|
import GitHub from 'next-auth/providers/github'
|
||||||
import { NextResponse } from 'next/server'
|
|
||||||
|
|
||||||
declare module 'next-auth' {
|
declare module 'next-auth' {
|
||||||
interface Session {
|
interface Session {
|
||||||
|
|
@ -14,7 +13,7 @@ declare module 'next-auth' {
|
||||||
export const {
|
export const {
|
||||||
handlers: { GET, POST },
|
handlers: { GET, POST },
|
||||||
auth,
|
auth,
|
||||||
CSRF_experimental
|
CSRF_experimental // will be removed in future
|
||||||
} = NextAuth({
|
} = NextAuth({
|
||||||
providers: [GitHub],
|
providers: [GitHub],
|
||||||
callbacks: {
|
callbacks: {
|
||||||
|
|
@ -26,10 +25,10 @@ export const {
|
||||||
return token
|
return token
|
||||||
},
|
},
|
||||||
authorized({ auth }) {
|
authorized({ auth }) {
|
||||||
return !!auth?.user
|
return !!auth?.user // this ensures there is a logged in user for -every- request
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pages: {
|
pages: {
|
||||||
signIn: '/sign-in'
|
signIn: '/sign-in' // overrides the next-auth default signin page https://authjs.dev/guides/basics/pages
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue