diff --git a/.changeset/grumpy-otters-kneel.md b/.changeset/grumpy-otters-kneel.md new file mode 100644 index 0000000000..0c34bb11e0 --- /dev/null +++ b/.changeset/grumpy-otters-kneel.md @@ -0,0 +1,5 @@ +--- +"create-t3-app": minor +--- + +update to next.js 15 and next-auth v5 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6d3d590996..ae0d0fc562 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -61,9 +61,9 @@ jobs: - run: cd ../ci-${{ matrix.trpc }}-${{ matrix.tailwind }}-${{ matrix.nextAuth }}-${{ matrix.prisma }}-${{ matrix.drizzle}}-${{ matrix.appRouter }}-${{ matrix.dbType }} && pnpm build if: ${{ steps.matrix-valid.outputs.continue == 'true' }} env: - NEXTAUTH_SECRET: foo - DISCORD_CLIENT_ID: bar - DISCORD_CLIENT_SECRET: baz + AUTH_SECRET: foo + AUTH_DISCORD_ID: bar + AUTH_DISCORD_SECRET: baz SKIP_ENV_VALIDATION: true build-t3-app-with-bun: @@ -101,7 +101,7 @@ jobs: - run: cd ../ci-bun && bun run build # - run: cd ../ci-bun && bun --bun run build env: - NEXTAUTH_SECRET: foo + AUTH_SECRET: foo + AUTH_DISCORD_ID: bar + AUTH_DISCORD_SECRET: baz DATABASE_URL: mysql://root:root@localhost:3306/test # can't use url from example env cause we block that in t3-env - DISCORD_CLIENT_ID: bar - DISCORD_CLIENT_SECRET: baz diff --git a/cli/src/helpers/logNextSteps.ts b/cli/src/helpers/logNextSteps.ts index 88629fc1b4..9ba296b55d 100644 --- a/cli/src/helpers/logNextSteps.ts +++ b/cli/src/helpers/logNextSteps.ts @@ -47,6 +47,12 @@ export const logNextSteps = async ({ } } + if (packages?.nextAuth.inUse) { + logger.info( + ` Fill in your .env with necessary values. See https://create.t3.gg/en/usage/first-steps for more info.` + ); + } + if (["npm", "bun"].includes(pkgManager)) { logger.info(` ${pkgManager} run dev`); } else { diff --git a/cli/src/installers/dependencyVersionMap.ts b/cli/src/installers/dependencyVersionMap.ts index 062c9e3740..868214a665 100644 --- a/cli/src/installers/dependencyVersionMap.ts +++ b/cli/src/installers/dependencyVersionMap.ts @@ -4,9 +4,9 @@ */ export const dependencyVersionMap = { // NextAuth.js - "next-auth": "^4.24.7", - "@auth/prisma-adapter": "^1.6.0", - "@auth/drizzle-adapter": "^1.1.0", + "next-auth": "5.0.0-beta.25", + "@auth/prisma-adapter": "^2.7.2", + "@auth/drizzle-adapter": "^1.7.2", // Prisma prisma: "^5.14.0", diff --git a/cli/src/installers/envVars.ts b/cli/src/installers/envVars.ts index a7377ccf6e..6288fab1b5 100644 --- a/cli/src/installers/envVars.ts +++ b/cli/src/installers/envVars.ts @@ -51,8 +51,19 @@ export const envVariablesInstaller: Installer = ({ const envDest = path.join(projectDir, ".env"); const envExampleDest = path.join(projectDir, ".env.example"); - fs.writeFileSync(envDest, envContent, "utf-8"); - fs.writeFileSync(envExampleDest, exampleEnvContent + envContent, "utf-8"); + const _exampleEnvContent = exampleEnvContent + envContent; + + // Generate an auth secret and put in .env, not .env.example + const secret = Buffer.from( + crypto.getRandomValues(new Uint8Array(32)) + ).toString("base64"); + const _envContent = envContent.replace( + 'AUTH_SECRET=""', + `AUTH_SECRET="${secret}" # Generated by create-t3-app.` + ); + + fs.writeFileSync(envDest, _envContent, "utf-8"); + fs.writeFileSync(envExampleDest, _exampleEnvContent, "utf-8"); }; const getEnvContent = ( @@ -69,6 +80,19 @@ const getEnvContent = ( .trim() .concat("\n"); + if (usingAuth) + content += ` +# Next Auth +# You can generate a new secret on the command line with: +# npx auth secret +# https://next-auth.js.org/configuration/options#secret +AUTH_SECRET="" + +# Next Auth Discord Provider +AUTH_DISCORD_ID="" +AUTH_DISCORD_SECRET="" +`; + if (usingPrisma) content += ` # Prisma @@ -97,20 +121,6 @@ DATABASE_URL='mysql://YOUR_MYSQL_URL_HERE?sslaccept=strict'`; content += "\n"; } - if (usingAuth) - content += ` -# Next Auth -# You can generate a new secret on the command line with: -# openssl rand -base64 32 -# https://next-auth.js.org/configuration/options#secret -# NEXTAUTH_SECRET="" -NEXTAUTH_URL="http://localhost:3000" - -# Next Auth Discord Provider -DISCORD_CLIENT_ID="" -DISCORD_CLIENT_SECRET="" -`; - if (!usingAuth && !usingPrisma) content += ` # Example: diff --git a/cli/src/installers/nextAuth.ts b/cli/src/installers/nextAuth.ts index 0886e90d7e..242c8e619b 100644 --- a/cli/src/installers/nextAuth.ts +++ b/cli/src/installers/nextAuth.ts @@ -6,11 +6,7 @@ import { type AvailableDependencies } from "~/installers/dependencyVersionMap.js import { type Installer } from "~/installers/index.js"; import { addPackageDependency } from "~/utils/addPackageDependency.js"; -export const nextAuthInstaller: Installer = ({ - projectDir, - packages, - appRouter, -}) => { +export const nextAuthInstaller: Installer = ({ projectDir, packages }) => { const usingPrisma = packages?.prisma.inUse; const usingDrizzle = packages?.drizzle.inUse; @@ -26,25 +22,26 @@ export const nextAuthInstaller: Installer = ({ const extrasDir = path.join(PKG_ROOT, "template/extras"); - const apiHandlerFile = "src/pages/api/auth/[...nextauth].ts"; - const routeHandlerFile = "src/app/api/auth/[...nextauth]/route.ts"; - const srcToUse = appRouter ? routeHandlerFile : apiHandlerFile; + const apiHandlerFile = "src/app/api/auth/[...nextauth]/route.ts"; - const apiHandlerSrc = path.join(extrasDir, srcToUse); - const apiHandlerDest = path.join(projectDir, srcToUse); + const apiHandlerSrc = path.join(extrasDir, apiHandlerFile); + const apiHandlerDest = path.join(projectDir, apiHandlerFile); const authConfigSrc = path.join( extrasDir, - "src/server", - appRouter ? "auth-app" : "auth-pages", + "src/server/auth/config", usingPrisma ? "with-prisma.ts" : usingDrizzle ? "with-drizzle.ts" : "base.ts" ); - const authConfigDest = path.join(projectDir, "src/server/auth.ts"); + const authConfigDest = path.join(projectDir, "src/server/auth/config.ts"); + + const authIndexSrc = path.join(extrasDir, "src/server/auth/index.ts"); + const authIndexDest = path.join(projectDir, "src/server/auth/index.ts"); fs.copySync(apiHandlerSrc, apiHandlerDest); fs.copySync(authConfigSrc, authConfigDest); + fs.copySync(authIndexSrc, authIndexDest); }; diff --git a/cli/src/installers/tailwind.ts b/cli/src/installers/tailwind.ts index c50ab68dc7..86188a241d 100644 --- a/cli/src/installers/tailwind.ts +++ b/cli/src/installers/tailwind.ts @@ -23,8 +23,8 @@ export const tailwindInstaller: Installer = ({ projectDir }) => { const twCfgSrc = path.join(extrasDir, "config/tailwind.config.ts"); const twCfgDest = path.join(projectDir, "tailwind.config.ts"); - const postcssCfgSrc = path.join(extrasDir, "config/postcss.config.cjs"); - const postcssCfgDest = path.join(projectDir, "postcss.config.cjs"); + const postcssCfgSrc = path.join(extrasDir, "config/postcss.config.js"); + const postcssCfgDest = path.join(projectDir, "postcss.config.js"); const prettierSrc = path.join(extrasDir, "config/_prettier.config.js"); const prettierDest = path.join(projectDir, "prettier.config.js"); diff --git a/cli/template/base/next.config.js b/cli/template/base/next.config.js index 98b6f90a51..0eff695958 100644 --- a/cli/template/base/next.config.js +++ b/cli/template/base/next.config.js @@ -2,7 +2,7 @@ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ -await import("./src/env.js"); +import "./src/env.js"; /** @type {import("next").NextConfig} */ const config = { diff --git a/cli/template/base/package.json b/cli/template/base/package.json index fff75519f8..00ca211bdc 100644 --- a/cli/template/base/package.json +++ b/cli/template/base/package.json @@ -4,7 +4,7 @@ "type": "module", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --turbo", "build": "next build", "start": "next start", "lint": "next lint", @@ -16,7 +16,7 @@ "dependencies": { "@t3-oss/env-nextjs": "^0.10.1", "geist": "^1.3.0", - "next": "^14.2.4", + "next": "^15.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", "zod": "^3.23.3" @@ -29,7 +29,7 @@ "@typescript-eslint/eslint-plugin": "^8.1.0", "@typescript-eslint/parser": "^8.1.0", "eslint": "^8.57.0", - "eslint-config-next": "^14.2.4", + "eslint-config-next": "^15.0.1", "typescript": "^5.5.3" } } diff --git a/cli/template/extras/config/_prettier.config.js b/cli/template/extras/config/_prettier.config.js index b2d59b460f..da332bd898 100644 --- a/cli/template/extras/config/_prettier.config.js +++ b/cli/template/extras/config/_prettier.config.js @@ -1,6 +1,4 @@ /** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */ -const config = { +export default { plugins: ["prettier-plugin-tailwindcss"], }; - -export default config; diff --git a/cli/template/extras/config/next-config-appdir.js b/cli/template/extras/config/next-config-appdir.js index 9bfe4a0e2a..121c4f4c24 100644 --- a/cli/template/extras/config/next-config-appdir.js +++ b/cli/template/extras/config/next-config-appdir.js @@ -2,7 +2,7 @@ * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ -await import("./src/env.js"); +import "./src/env.js"; /** @type {import("next").NextConfig} */ const config = {}; diff --git a/cli/template/extras/config/postcss.config.cjs b/cli/template/extras/config/postcss.config.cjs deleted file mode 100644 index 4cdb2f430f..0000000000 --- a/cli/template/extras/config/postcss.config.cjs +++ /dev/null @@ -1,7 +0,0 @@ -const config = { - plugins: { - tailwindcss: {}, - }, -}; - -module.exports = config; diff --git a/cli/template/extras/config/postcss.config.js b/cli/template/extras/config/postcss.config.js new file mode 100644 index 0000000000..01bf7432f6 --- /dev/null +++ b/cli/template/extras/config/postcss.config.js @@ -0,0 +1,5 @@ +export default { + plugins: { + tailwindcss: {}, + }, +}; diff --git a/cli/template/extras/src/app/api/auth/[...nextauth]/route.ts b/cli/template/extras/src/app/api/auth/[...nextauth]/route.ts index 7ef89677f2..8e8302c8d8 100644 --- a/cli/template/extras/src/app/api/auth/[...nextauth]/route.ts +++ b/cli/template/extras/src/app/api/auth/[...nextauth]/route.ts @@ -1,7 +1,3 @@ -import NextAuth from "next-auth"; +import { handlers } from "~/server/auth"; -import { authOptions } from "~/server/auth"; - -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -const handler = NextAuth(authOptions); -export { handler as GET, handler as POST }; +export const { GET, POST } = handlers; diff --git a/cli/template/extras/src/app/page/with-auth-trpc-tw.tsx b/cli/template/extras/src/app/page/with-auth-trpc-tw.tsx index 1d462b4441..37cc32ff48 100644 --- a/cli/template/extras/src/app/page/with-auth-trpc-tw.tsx +++ b/cli/template/extras/src/app/page/with-auth-trpc-tw.tsx @@ -1,12 +1,12 @@ import Link from "next/link"; import { LatestPost } from "~/app/_components/post"; -import { getServerAuthSession } from "~/server/auth"; +import { auth } from "~/server/auth"; import { api, HydrateClient } from "~/trpc/server"; export default async function Home() { const hello = await api.post.hello({ text: "from tRPC" }); - const session = await getServerAuthSession(); + const session = await auth(); if (session?.user) { void api.post.getLatest.prefetch(); diff --git a/cli/template/extras/src/app/page/with-auth-trpc.tsx b/cli/template/extras/src/app/page/with-auth-trpc.tsx index 74cac168f9..ba570d252e 100644 --- a/cli/template/extras/src/app/page/with-auth-trpc.tsx +++ b/cli/template/extras/src/app/page/with-auth-trpc.tsx @@ -1,13 +1,13 @@ import Link from "next/link"; import { LatestPost } from "~/app/_components/post"; -import { getServerAuthSession } from "~/server/auth"; +import { auth } from "~/server/auth"; import { api, HydrateClient } from "~/trpc/server"; import styles from "./index.module.css"; export default async function Home() { const hello = await api.post.hello({ text: "from tRPC" }); - const session = await getServerAuthSession(); + const session = await auth(); if (session?.user) { void api.post.getLatest.prefetch(); diff --git a/cli/template/extras/src/env/with-auth-db-planetscale.js b/cli/template/extras/src/env/with-auth-db-planetscale.js index 35a053ec5b..01abd8e6f1 100644 --- a/cli/template/extras/src/env/with-auth-db-planetscale.js +++ b/cli/template/extras/src/env/with-auth-db-planetscale.js @@ -7,6 +7,12 @@ export const env = createEnv({ * isn't built with invalid env vars. */ server: { + AUTH_SECRET: + process.env.NODE_ENV === "production" + ? z.string() + : z.string().optional(), + AUTH_DISCORD_ID: z.string(), + AUTH_DISCORD_SECRET: z.string(), DATABASE_URL: z .string() .url() @@ -17,19 +23,6 @@ export const env = createEnv({ NODE_ENV: z .enum(["development", "test", "production"]) .default("development"), - NEXTAUTH_SECRET: - process.env.NODE_ENV === "production" - ? z.string() - : z.string().optional(), - NEXTAUTH_URL: z.preprocess( - // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL - // Since NextAuth.js automatically uses the VERCEL_URL if present. - (str) => process.env.VERCEL_URL ?? str, - // VERCEL_URL doesn't include `https` so it cant be validated as a URL - process.env.VERCEL ? z.string() : z.string().url() - ), - DISCORD_CLIENT_ID: z.string(), - DISCORD_CLIENT_SECRET: z.string(), }, /** @@ -46,12 +39,11 @@ export const env = createEnv({ * middlewares) or client-side so we need to destruct manually. */ runtimeEnv: { + AUTH_SECRET: process.env.AUTH_SECRET, + AUTH_DISCORD_ID: process.env.AUTH_DISCORD_ID, + AUTH_DISCORD_SECRET: process.env.AUTH_DISCORD_SECRET, DATABASE_URL: process.env.DATABASE_URL, NODE_ENV: process.env.NODE_ENV, - NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, - NEXTAUTH_URL: process.env.NEXTAUTH_URL, - DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, - DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, }, /** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially diff --git a/cli/template/extras/src/env/with-auth-db.js b/cli/template/extras/src/env/with-auth-db.js index 2467d22d0f..6b19f72401 100644 --- a/cli/template/extras/src/env/with-auth-db.js +++ b/cli/template/extras/src/env/with-auth-db.js @@ -7,23 +7,16 @@ export const env = createEnv({ * isn't built with invalid env vars. */ server: { + AUTH_SECRET: + process.env.NODE_ENV === "production" + ? z.string() + : z.string().optional(), + AUTH_DISCORD_ID: z.string(), + AUTH_DISCORD_SECRET: z.string(), DATABASE_URL: z.string().url(), NODE_ENV: z .enum(["development", "test", "production"]) .default("development"), - NEXTAUTH_SECRET: - process.env.NODE_ENV === "production" - ? z.string() - : z.string().optional(), - NEXTAUTH_URL: z.preprocess( - // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL - // Since NextAuth.js automatically uses the VERCEL_URL if present. - (str) => process.env.VERCEL_URL ?? str, - // VERCEL_URL doesn't include `https` so it cant be validated as a URL - process.env.VERCEL ? z.string() : z.string().url() - ), - DISCORD_CLIENT_ID: z.string(), - DISCORD_CLIENT_SECRET: z.string(), }, /** @@ -40,12 +33,11 @@ export const env = createEnv({ * middlewares) or client-side so we need to destruct manually. */ runtimeEnv: { + AUTH_SECRET: process.env.AUTH_SECRET, + AUTH_DISCORD_ID: process.env.AUTH_DISCORD_ID, + AUTH_DISCORD_SECRET: process.env.AUTH_DISCORD_SECRET, DATABASE_URL: process.env.DATABASE_URL, NODE_ENV: process.env.NODE_ENV, - NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, - NEXTAUTH_URL: process.env.NEXTAUTH_URL, - DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, - DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, }, /** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially diff --git a/cli/template/extras/src/env/with-auth.js b/cli/template/extras/src/env/with-auth.js index 42cc12648d..45b5cba0a3 100644 --- a/cli/template/extras/src/env/with-auth.js +++ b/cli/template/extras/src/env/with-auth.js @@ -7,22 +7,15 @@ export const env = createEnv({ * isn't built with invalid env vars. */ server: { - NODE_ENV: z - .enum(["development", "test", "production"]) - .default("development"), - NEXTAUTH_SECRET: + AUTH_SECRET: process.env.NODE_ENV === "production" ? z.string() : z.string().optional(), - NEXTAUTH_URL: z.preprocess( - // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL - // Since NextAuth.js automatically uses the VERCEL_URL if present. - (str) => process.env.VERCEL_URL ?? str, - // VERCEL_URL doesn't include `https` so it cant be validated as a URL - process.env.VERCEL ? z.string() : z.string().url() - ), - DISCORD_CLIENT_ID: z.string(), - DISCORD_CLIENT_SECRET: z.string(), + AUTH_DISCORD_ID: z.string(), + AUTH_DISCORD_SECRET: z.string(), + NODE_ENV: z + .enum(["development", "test", "production"]) + .default("development"), }, /** @@ -39,11 +32,10 @@ export const env = createEnv({ * middlewares) or client-side so we need to destruct manually. */ runtimeEnv: { + AUTH_SECRET: process.env.AUTH_SECRET, + AUTH_DISCORD_ID: process.env.AUTH_DISCORD_ID, + AUTH_DISCORD_SECRET: process.env.AUTH_DISCORD_SECRET, NODE_ENV: process.env.NODE_ENV, - NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, - NEXTAUTH_URL: process.env.NEXTAUTH_URL, - DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, - DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, }, /** diff --git a/cli/template/extras/src/pages/api/auth/[...nextauth].ts b/cli/template/extras/src/pages/api/auth/[...nextauth].ts deleted file mode 100644 index 8739530ffd..0000000000 --- a/cli/template/extras/src/pages/api/auth/[...nextauth].ts +++ /dev/null @@ -1,5 +0,0 @@ -import NextAuth from "next-auth"; - -import { authOptions } from "~/server/auth"; - -export default NextAuth(authOptions); diff --git a/cli/template/extras/src/server/api/trpc-app/with-auth-db.ts b/cli/template/extras/src/server/api/trpc-app/with-auth-db.ts index 0021e07cbd..00d924faa8 100644 --- a/cli/template/extras/src/server/api/trpc-app/with-auth-db.ts +++ b/cli/template/extras/src/server/api/trpc-app/with-auth-db.ts @@ -11,7 +11,7 @@ import { initTRPC, TRPCError } from "@trpc/server"; import superjson from "superjson"; import { ZodError } from "zod"; -import { getServerAuthSession } from "~/server/auth"; +import { auth } from "~/server/auth"; import { db } from "~/server/db"; /** @@ -27,7 +27,7 @@ import { db } from "~/server/db"; * @see https://trpc.io/docs/server/context */ export const createTRPCContext = async (opts: { headers: Headers }) => { - const session = await getServerAuthSession(); + const session = await auth(); return { db, diff --git a/cli/template/extras/src/server/api/trpc-app/with-auth.ts b/cli/template/extras/src/server/api/trpc-app/with-auth.ts index 3c688d34c2..755b973c29 100644 --- a/cli/template/extras/src/server/api/trpc-app/with-auth.ts +++ b/cli/template/extras/src/server/api/trpc-app/with-auth.ts @@ -10,7 +10,7 @@ import { initTRPC, TRPCError } from "@trpc/server"; import superjson from "superjson"; import { ZodError } from "zod"; -import { getServerAuthSession } from "~/server/auth"; +import { auth } from "~/server/auth"; /** * 1. CONTEXT @@ -25,7 +25,7 @@ import { getServerAuthSession } from "~/server/auth"; * @see https://trpc.io/docs/server/context */ export const createTRPCContext = async (opts: { headers: Headers }) => { - const session = await getServerAuthSession(); + const session = await auth(); return { session, diff --git a/cli/template/extras/src/server/api/trpc-pages/with-auth-db.ts b/cli/template/extras/src/server/api/trpc-pages/with-auth-db.ts index b0456c8f94..8b4f3632a7 100644 --- a/cli/template/extras/src/server/api/trpc-pages/with-auth-db.ts +++ b/cli/template/extras/src/server/api/trpc-pages/with-auth-db.ts @@ -13,7 +13,7 @@ import { type Session } from "next-auth"; import superjson from "superjson"; import { ZodError } from "zod"; -import { getServerAuthSession } from "~/server/auth"; +import { auth } from "~/server/auth"; import { db } from "~/server/db"; /** @@ -55,7 +55,7 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => { const { req, res } = opts; // Get the session from the server using the getServerSession wrapper function - const session = await getServerAuthSession({ req, res }); + const session = await auth(req, res); return createInnerTRPCContext({ session, diff --git a/cli/template/extras/src/server/api/trpc-pages/with-auth.ts b/cli/template/extras/src/server/api/trpc-pages/with-auth.ts index 3148e056f1..7fe732be6b 100644 --- a/cli/template/extras/src/server/api/trpc-pages/with-auth.ts +++ b/cli/template/extras/src/server/api/trpc-pages/with-auth.ts @@ -12,7 +12,7 @@ import { type Session } from "next-auth"; import superjson from "superjson"; import { ZodError } from "zod"; -import { getServerAuthSession } from "~/server/auth"; +import { auth } from "~/server/auth"; /** * 1. CONTEXT @@ -53,7 +53,7 @@ export const createTRPCContext = async ({ res, }: CreateNextContextOptions) => { // Get the session from the server using the getServerSession wrapper function - const session = await getServerAuthSession({ req, res }); + const session = await auth(req, res); return createInnerTRPCContext({ session, diff --git a/cli/template/extras/src/server/auth-pages/base.ts b/cli/template/extras/src/server/auth-pages/base.ts deleted file mode 100644 index cbeceb4c16..0000000000 --- a/cli/template/extras/src/server/auth-pages/base.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { type GetServerSidePropsContext } from "next"; -import { - getServerSession, - type DefaultSession, - type NextAuthOptions, -} from "next-auth"; -import DiscordProvider from "next-auth/providers/discord"; - -import { env } from "~/env"; - -/** - * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session` - * object and keep type safety. - * - * @see https://next-auth.js.org/getting-started/typescript#module-augmentation - */ -declare module "next-auth" { - interface Session extends DefaultSession { - user: DefaultSession["user"] & { - id: string; - // ...other properties - // role: UserRole; - }; - } - - // interface User { - // // ...other properties - // // role: UserRole; - // } -} - -/** - * Options for NextAuth.js used to configure adapters, providers, callbacks, etc. - * - * @see https://next-auth.js.org/configuration/options - */ -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, token }) => ({ - ...session, - user: { - ...session.user, - id: token.sub, - }, - }), - }, - providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), - /** - * ...add more providers here. - * - * Most other providers require a bit more work than the Discord provider. For example, the - * GitHub provider requires you to add the `refresh_token_expires_in` field to the Account - * model. Refer to the NextAuth.js docs for the provider you want to use. Example: - * - * @see https://next-auth.js.org/providers/github - */ - ], -}; - -/** - * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. - * - * @see https://next-auth.js.org/configuration/nextjs - */ -export const getServerAuthSession = (ctx: { - req: GetServerSidePropsContext["req"]; - res: GetServerSidePropsContext["res"]; -}) => { - return getServerSession(ctx.req, ctx.res, authOptions); -}; diff --git a/cli/template/extras/src/server/auth-pages/with-drizzle.ts b/cli/template/extras/src/server/auth-pages/with-drizzle.ts deleted file mode 100644 index c7788937f0..0000000000 --- a/cli/template/extras/src/server/auth-pages/with-drizzle.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { DrizzleAdapter } from "@auth/drizzle-adapter"; -import { type GetServerSidePropsContext } from "next"; -import { - getServerSession, - type DefaultSession, - type NextAuthOptions, -} from "next-auth"; -import { type Adapter } from "next-auth/adapters"; -import DiscordProvider from "next-auth/providers/discord"; - -import { env } from "~/env"; -import { db } from "~/server/db"; -import { - accounts, - sessions, - users, - verificationTokens, -} from "~/server/db/schema"; - -/** - * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session` - * object and keep type safety. - * - * @see https://next-auth.js.org/getting-started/typescript#module-augmentation - */ -declare module "next-auth" { - interface Session extends DefaultSession { - user: { - id: string; - // ...other properties - // role: UserRole; - } & DefaultSession["user"]; - } - - // interface User { - // // ...other properties - // // role: UserRole; - // } -} - -/** - * Options for NextAuth.js used to configure adapters, providers, callbacks, etc. - * - * @see https://next-auth.js.org/configuration/options - */ -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, user }) => ({ - ...session, - user: { - ...session.user, - id: user.id, - }, - }), - }, - adapter: DrizzleAdapter(db, { - usersTable: users, - accountsTable: accounts, - sessionsTable: sessions, - verificationTokensTable: verificationTokens, - }) as Adapter, - providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), - /** - * ...add more providers here. - * - * Most other providers require a bit more work than the Discord provider. For example, the - * GitHub provider requires you to add the `refresh_token_expires_in` field to the Account - * model. Refer to the NextAuth.js docs for the provider you want to use. Example: - * - * @see https://next-auth.js.org/providers/github - */ - ], -}; - -/** - * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. - * - * @see https://next-auth.js.org/configuration/nextjs - */ -export const getServerAuthSession = (ctx: { - req: GetServerSidePropsContext["req"]; - res: GetServerSidePropsContext["res"]; -}) => { - return getServerSession(ctx.req, ctx.res, authOptions); -}; diff --git a/cli/template/extras/src/server/auth-pages/with-prisma.ts b/cli/template/extras/src/server/auth-pages/with-prisma.ts deleted file mode 100644 index ee03a40d73..0000000000 --- a/cli/template/extras/src/server/auth-pages/with-prisma.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { PrismaAdapter } from "@auth/prisma-adapter"; -import { type GetServerSidePropsContext } from "next"; -import { - getServerSession, - type DefaultSession, - type NextAuthOptions, -} from "next-auth"; -import { type Adapter } from "next-auth/adapters"; -import DiscordProvider from "next-auth/providers/discord"; - -import { env } from "~/env"; -import { db } from "~/server/db"; - -/** - * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session` - * object and keep type safety. - * - * @see https://next-auth.js.org/getting-started/typescript#module-augmentation - */ -declare module "next-auth" { - interface Session extends DefaultSession { - user: DefaultSession["user"] & { - id: string; - // ...other properties - // role: UserRole; - }; - } - - // interface User { - // // ...other properties - // // role: UserRole; - // } -} - -/** - * Options for NextAuth.js used to configure adapters, providers, callbacks, etc. - * - * @see https://next-auth.js.org/configuration/options - */ -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, user }) => ({ - ...session, - user: { - ...session.user, - id: user.id, - }, - }), - }, - adapter: PrismaAdapter(db) as Adapter, - providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), - /** - * ...add more providers here. - * - * Most other providers require a bit more work than the Discord provider. For example, the - * GitHub provider requires you to add the `refresh_token_expires_in` field to the Account - * model. Refer to the NextAuth.js docs for the provider you want to use. Example: - * - * @see https://next-auth.js.org/providers/github - */ - ], -}; - -/** - * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. - * - * @see https://next-auth.js.org/configuration/nextjs - */ -export const getServerAuthSession = (ctx: { - req: GetServerSidePropsContext["req"]; - res: GetServerSidePropsContext["res"]; -}) => { - return getServerSession(ctx.req, ctx.res, authOptions); -}; diff --git a/cli/template/extras/src/server/auth-app/base.ts b/cli/template/extras/src/server/auth/config/base.ts similarity index 70% rename from cli/template/extras/src/server/auth-app/base.ts rename to cli/template/extras/src/server/auth/config/base.ts index 9c170aaaae..c88101a0b4 100644 --- a/cli/template/extras/src/server/auth-app/base.ts +++ b/cli/template/extras/src/server/auth/config/base.ts @@ -1,12 +1,6 @@ -import { - getServerSession, - type DefaultSession, - type NextAuthOptions, -} from "next-auth"; +import { type DefaultSession, type NextAuthConfig } from "next-auth"; import DiscordProvider from "next-auth/providers/discord"; -import { env } from "~/env"; - /** * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session` * object and keep type safety. @@ -33,21 +27,9 @@ declare module "next-auth" { * * @see https://next-auth.js.org/configuration/options */ -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, token }) => ({ - ...session, - user: { - ...session.user, - id: token.sub, - }, - }), - }, +export const authConfig = { providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), + DiscordProvider, /** * ...add more providers here. * @@ -58,11 +40,13 @@ export const authOptions: NextAuthOptions = { * @see https://next-auth.js.org/providers/github */ ], -}; - -/** - * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. - * - * @see https://next-auth.js.org/configuration/nextjs - */ -export const getServerAuthSession = () => getServerSession(authOptions); + callbacks: { + session: ({ session, token }) => ({ + ...session, + user: { + ...session.user, + id: token.sub, + }, + }), + }, +} satisfies NextAuthConfig; diff --git a/cli/template/extras/src/server/auth-app/with-drizzle.ts b/cli/template/extras/src/server/auth/config/with-drizzle.ts similarity index 73% rename from cli/template/extras/src/server/auth-app/with-drizzle.ts rename to cli/template/extras/src/server/auth/config/with-drizzle.ts index 6e9281d157..3ef82a2f63 100644 --- a/cli/template/extras/src/server/auth-app/with-drizzle.ts +++ b/cli/template/extras/src/server/auth/config/with-drizzle.ts @@ -1,13 +1,7 @@ import { DrizzleAdapter } from "@auth/drizzle-adapter"; -import { - getServerSession, - type DefaultSession, - type NextAuthOptions, -} from "next-auth"; -import { type Adapter } from "next-auth/adapters"; +import { type DefaultSession, type NextAuthConfig } from "next-auth"; import DiscordProvider from "next-auth/providers/discord"; -import { env } from "~/env"; import { db } from "~/server/db"; import { accounts, @@ -42,27 +36,9 @@ declare module "next-auth" { * * @see https://next-auth.js.org/configuration/options */ -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, user }) => ({ - ...session, - user: { - ...session.user, - id: user.id, - }, - }), - }, - adapter: DrizzleAdapter(db, { - usersTable: users, - accountsTable: accounts, - sessionsTable: sessions, - verificationTokensTable: verificationTokens, - }) as Adapter, +export const authConfig = { providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), + DiscordProvider, /** * ...add more providers here. * @@ -73,11 +49,19 @@ export const authOptions: NextAuthOptions = { * @see https://next-auth.js.org/providers/github */ ], -}; - -/** - * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. - * - * @see https://next-auth.js.org/configuration/nextjs - */ -export const getServerAuthSession = () => getServerSession(authOptions); + adapter: DrizzleAdapter(db, { + usersTable: users, + accountsTable: accounts, + sessionsTable: sessions, + verificationTokensTable: verificationTokens, + }), + callbacks: { + session: ({ session, user }) => ({ + ...session, + user: { + ...session.user, + id: user.id, + }, + }), + }, +} satisfies NextAuthConfig; diff --git a/cli/template/extras/src/server/auth-app/with-prisma.ts b/cli/template/extras/src/server/auth/config/with-prisma.ts similarity index 68% rename from cli/template/extras/src/server/auth-app/with-prisma.ts rename to cli/template/extras/src/server/auth/config/with-prisma.ts index 117984c9bd..9b8ec7997f 100644 --- a/cli/template/extras/src/server/auth-app/with-prisma.ts +++ b/cli/template/extras/src/server/auth/config/with-prisma.ts @@ -1,13 +1,7 @@ import { PrismaAdapter } from "@auth/prisma-adapter"; -import { - getServerSession, - type DefaultSession, - type NextAuthOptions, -} from "next-auth"; -import { type Adapter } from "next-auth/adapters"; +import { type DefaultSession, type NextAuthConfig } from "next-auth"; import DiscordProvider from "next-auth/providers/discord"; -import { env } from "~/env"; import { db } from "~/server/db"; /** @@ -36,22 +30,9 @@ declare module "next-auth" { * * @see https://next-auth.js.org/configuration/options */ -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, user }) => ({ - ...session, - user: { - ...session.user, - id: user.id, - }, - }), - }, - adapter: PrismaAdapter(db) as Adapter, +export const authConfig = { providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), + DiscordProvider, /** * ...add more providers here. * @@ -62,11 +43,14 @@ export const authOptions: NextAuthOptions = { * @see https://next-auth.js.org/providers/github */ ], -}; - -/** - * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file. - * - * @see https://next-auth.js.org/configuration/nextjs - */ -export const getServerAuthSession = () => getServerSession(authOptions); + adapter: PrismaAdapter(db), + callbacks: { + session: ({ session, user }) => ({ + ...session, + user: { + ...session.user, + id: user.id, + }, + }), + }, +} satisfies NextAuthConfig; diff --git a/cli/template/extras/src/server/auth/index.ts b/cli/template/extras/src/server/auth/index.ts new file mode 100644 index 0000000000..76c146d34a --- /dev/null +++ b/cli/template/extras/src/server/auth/index.ts @@ -0,0 +1,10 @@ +import NextAuth from "next-auth"; +import { cache } from "react"; + +import { authConfig } from "./config"; + +const { auth: uncachedAuth, handlers, signIn, signOut } = NextAuth(authConfig); + +const auth = cache(uncachedAuth); + +export { auth, handlers, signIn, signOut }; diff --git a/cli/template/extras/src/trpc/server.ts b/cli/template/extras/src/trpc/server.ts index 59300a638b..91e557e45f 100644 --- a/cli/template/extras/src/trpc/server.ts +++ b/cli/template/extras/src/trpc/server.ts @@ -12,8 +12,8 @@ import { createQueryClient } from "./query-client"; * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ -const createContext = cache(() => { - const heads = new Headers(headers()); +const createContext = cache(async () => { + const heads = new Headers(await headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ diff --git a/www/src/components/docs/folderStructureDiagramApp.astro b/www/src/components/docs/folderStructureDiagramApp.astro index 0b175db152..68e9690737 100644 --- a/www/src/components/docs/folderStructureDiagramApp.astro +++ b/www/src/components/docs/folderStructureDiagramApp.astro @@ -41,7 +41,7 @@ "next-env.d.ts": [], "next.config.js": [], "package.json": [], - "postcss.config.cjs": ["tailwind"], + "postcss.config.js": ["tailwind"], "prettier.config.js": ["tailwind"], "README.md": [], "start-database.sh (mysql or postgres only)": ["drizzle"], diff --git a/www/src/components/docs/folderStructureDiagramPages.astro b/www/src/components/docs/folderStructureDiagramPages.astro index 8676e66019..8756fb6f4c 100644 --- a/www/src/components/docs/folderStructureDiagramPages.astro +++ b/www/src/components/docs/folderStructureDiagramPages.astro @@ -38,7 +38,7 @@ "next-env.d.ts": [], "next.config.js": [], "package.json": [], - "postcss.config.cjs": ["tailwind"], + "postcss.config.js": ["tailwind"], "prettier.config.js": ["tailwind"], "README.md": [], "start-database.sh (mysql or postgres only)": ["drizzle"], diff --git a/www/src/components/navigation/tableOfContents.astro b/www/src/components/navigation/tableOfContents.astro index 65b9ad134f..fed095ffe8 100644 --- a/www/src/components/navigation/tableOfContents.astro +++ b/www/src/components/navigation/tableOfContents.astro @@ -39,7 +39,7 @@ const isRtl = getIsRtlFromUrl(pathname); case "src/server/auth.ts": dataComponentType = "nextauth"; break; - case "postcss.config.cjs": + case "postcss.config.js": case "prettier.config.mjs": dataComponentType = "tailwind"; break; diff --git a/www/src/pages/ar/folder-structure-pages.mdx b/www/src/pages/ar/folder-structure-pages.mdx index aafcc4f850..95ddbefc07 100644 --- a/www/src/pages/ar/folder-structure-pages.mdx +++ b/www/src/pages/ar/folder-structure-pages.mdx @@ -198,9 +198,9 @@ import Form from "../../components/docs/folderStructureForm.astro";
-### `postcss.config.cjs` +### `postcss.config.js` -إن ملف `postcss.config.cjs` ضروري عند استخدام TailwindCSS PostCSS، لمزيد من المعلومات [Taiwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss). +إن ملف `postcss.config.js` ضروري عند استخدام TailwindCSS PostCSS، لمزيد من المعلومات [Taiwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss).
diff --git a/www/src/pages/ar/usage/first-steps.md b/www/src/pages/ar/usage/first-steps.md index 813bae3a3f..a75cbca37a 100644 --- a/www/src/pages/ar/usage/first-steps.md +++ b/www/src/pages/ar/usage/first-steps.md @@ -22,8 +22,8 @@ dir: rtl ثم اذهب **<** Settings **<** OAuth2 **<** General -قم بنسخ Client ID وضعه في `.env `كـ `DISCORD_CLIENT_ID` +قم بنسخ Client ID وضعه في `.env `كـ `AUTH_DISCORD_ID` -اضغط علي Reset Secret ثم انسخ كلمة السر الجديدة وضعها في .env كـ DISCORD_CLIENT_SECRET +اضغط علي Reset Secret ثم انسخ كلمة السر الجديدة وضعها في .env كـ AUTH_DISCORD_SECRET اضغط علي Add Redirect واضف http://localhost:3000/api/auth/callback/discord -اضف NEXTAUTH_SECRET الي .env كـ String، في الـ Production اضف كلمة سر قوية. +اضف AUTH_SECRET الي .env كـ String، في الـ Production اضف كلمة سر قوية. diff --git a/www/src/pages/ar/usage/next-auth.md b/www/src/pages/ar/usage/next-auth.md index 565ef7be0d..8d65fb8a71 100644 --- a/www/src/pages/ar/usage/next-auth.md +++ b/www/src/pages/ar/usage/next-auth.md @@ -159,9 +159,9 @@ const userRouter = router({ 2. في settings menu اضغط على OAuth2 ثم General -3. إنسخ الـ Client ID وضعة في `.env` كـ DISCORD_CLIENT_ID +3. إنسخ الـ Client ID وضعة في `.env` كـ AUTH_DISCORD_ID -4. تحت Client Secret اضغط على "Reset Secret" ونسخ النص الجديد وضعه في `.env` كـ `DISCORD_CLIENT_SECRET `. +4. تحت Client Secret اضغط على "Reset Secret" ونسخ النص الجديد وضعه في `.env` كـ `AUTH_DISCORD_SECRET `. كن حذرًا لأنك لن تتمكن من رؤية هذا كلمة السر مرة أخرى ، ستؤدي إعادة تعيينها إلى انتهاء صلاحية كلمة السر الحالية 5. اضغط على Add Redirect واضف رابط إعادة التوجيه`http://localhost:3000/api/auth/callback/discord` كمثال 6. احفظ التعديلات diff --git a/www/src/pages/en/folder-structure-app.mdx b/www/src/pages/en/folder-structure-app.mdx index 2c15167216..3005ddb419 100644 --- a/www/src/pages/en/folder-structure-app.mdx +++ b/www/src/pages/en/folder-structure-app.mdx @@ -226,9 +226,9 @@ The `next.config.mjs` file is used to configure Next.js. See [Next.js Docs](http
-### `postcss.config.cjs` +### `postcss.config.js` -The `postcss.config.cjs` file is used for Tailwind PostCSS usage. See [Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss) for more information. +The `postcss.config.js` file is used for Tailwind PostCSS usage. See [Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss) for more information.
diff --git a/www/src/pages/en/folder-structure-pages.mdx b/www/src/pages/en/folder-structure-pages.mdx index 9cad8be65b..47d7c35a6f 100644 --- a/www/src/pages/en/folder-structure-pages.mdx +++ b/www/src/pages/en/folder-structure-pages.mdx @@ -219,9 +219,9 @@ The `next.config.mjs` file is used to configure Next.js. See [Next.js Docs](http
-### `postcss.config.cjs` +### `postcss.config.js` -The `postcss.config.cjs` file is used for Tailwind PostCSS usage. See [Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss) for more information. +The `postcss.config.js` file is used for Tailwind PostCSS usage. See [Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss) for more information.
diff --git a/www/src/pages/en/usage/first-steps.md b/www/src/pages/en/usage/first-steps.md index 44e39074c4..a90b52c600 100644 --- a/www/src/pages/en/usage/first-steps.md +++ b/www/src/pages/en/usage/first-steps.md @@ -30,12 +30,11 @@ Of course, if you prefer to use a different auth provider, you can also use one 1. You will need a Discord account, so register one if you haven't already. 2. Navigate to https://discord.com/developers/applications and click "New Application" in the top right corner. Give your application a name and agree to the Terms of Service. 3. Once your application has been created, navigate to "Settings → OAuth2 → General". -4. Copy the "Client ID" and add it to your `.env` as `DISCORD_CLIENT_ID`. -5. Click "Reset Secret", copy the new secret, and add it to your `.env` as `DISCORD_CLIENT_SECRET`. +4. Copy the "Client ID" and add it to your `.env` as `AUTH_DISCORD_ID`. +5. Click "Reset Secret", copy the new secret, and add it to your `.env` as `AUTH_DISCORD_SECRET`. 6. Click "Add Redirect" and type in `http://localhost:3000/api/auth/callback/discord`. - For production deployment, follow the previous steps to create another Discord Application, but this time replace `http://localhost:3000` with the URL that you are deploying to. 7. Save Changes. -8. Set the `NEXTAUTH_SECRET` in `.env`. In development any string will work, for production see the note in `.env` on generating a secure secret. You should now be able to log in. diff --git a/www/src/pages/en/usage/next-auth.mdx b/www/src/pages/en/usage/next-auth.mdx index 7a5d68d5b0..9a0b41e8fb 100644 --- a/www/src/pages/en/usage/next-auth.mdx +++ b/www/src/pages/en/usage/next-auth.mdx @@ -213,8 +213,8 @@ I.e.: 1. Head to [the Applications section in the Discord Developer Portal](https://discord.com/developers/applications), and click on "New Application" 2. In the settings menu, go to "OAuth2 => General" -- Copy the Client ID and paste it in `DISCORD_CLIENT_ID` in `.env`. -- Under Client Secret, click "Reset Secret" and copy that string to `DISCORD_CLIENT_SECRET` in `.env`. Be careful as you won't be able to see this secret again, and resetting it will cause the existing one to expire. +- Copy the Client ID and paste it in `AUTH_DISCORD_ID` in `.env`. +- Under Client Secret, click "Reset Secret" and copy that string to `AUTH_DISCORD_SECRET` in `.env`. Be careful as you won't be able to see this secret again, and resetting it will cause the existing one to expire. - Click "Add Redirect" and paste in `/api/auth/callback/discord` (example for local development: http://localhost:3000/api/auth/callback/discord) - Save your changes - It is possible, but not recommended, to use the same Discord Application for both development and production. You could also consider [Mocking the Provider](https://github.com/trpc/trpc/blob/main/examples/next-prisma-websockets-starter/src/pages/api/auth/%5B...nextauth%5D.ts) during development. diff --git a/www/src/pages/es/folder-structure-pages.mdx b/www/src/pages/es/folder-structure-pages.mdx index 53f5298121..38017f3cc3 100644 --- a/www/src/pages/es/folder-structure-pages.mdx +++ b/www/src/pages/es/folder-structure-pages.mdx @@ -206,9 +206,9 @@ El archivo `next.config.mjs` se usa para configurar Next.js. Consulta [la docume
-### `postcss.config.cjs` +### `postcss.config.js` -El archivo `postcss.config.cjs` se usa para la configuración de Tailwind PostCSS. Consulta [la documentación de Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) para obtener más información. +El archivo `postcss.config.js` se usa para la configuración de Tailwind PostCSS. Consulta [la documentación de Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) para obtener más información.
diff --git a/www/src/pages/es/usage/first-steps.md b/www/src/pages/es/usage/first-steps.md index c262a31c28..a49b71219b 100644 --- a/www/src/pages/es/usage/first-steps.md +++ b/www/src/pages/es/usage/first-steps.md @@ -20,12 +20,11 @@ Por supuesto, si prefieres usar un proveedor de autenticación diferente, tambi 1. Necesitarás una cuenta de Discord, así que crea una cuenta si aún no lo has hecho. 2. Dirígite a [https://discord.com/developers/applications](https://discord.com/developers/applications) y haz clic en "New Application" en la esquina superior derecha. Asigna un nombre a tu aplicación y acepta los términos de servicio. 3. Una vez creada tu aplicación, dirígite a "Settings → OAuth2 → General". -4. Copia el "Client ID" y agrégalo a tu `.env` como `DISCORD_CLIENT_ID`. -5. Haz clic en "Reset Secret", copia el nuevo valor secreto y agrégalo a tu `.env` como `DISCORD_CLIENT_SECRET`. +4. Copia el "Client ID" y agrégalo a tu `.env` como `AUTH_DISCORD_ID`. +5. Haz clic en "Reset Secret", copia el nuevo valor secreto y agrégalo a tu `.env` como `AUTH_DISCORD_SECRET`. 6. Haz clic en "Add Redirect" y escribe `http://localhost:3000/api/auth/callback/discord`. - Para la implementación de producción, sigue los pasos anteriores para crear otra aplicación Discord, pero esta vez reemplaza `http://localhost:3000` con la URL de producción en la que está implementando. 7. Guarda los cambios. -8. Configura `NEXTAUTH_SECRET` en `.env`. En desarrollo, cualquier cadena funcionará, para producción, consulta la nota de `.env` sobre la generación de un secreto seguro. Ahora deberías poder iniciar sesión. diff --git a/www/src/pages/es/usage/next-auth.md b/www/src/pages/es/usage/next-auth.md index 27a17a3eb6..ffc7be4b9b 100644 --- a/www/src/pages/es/usage/next-auth.md +++ b/www/src/pages/es/usage/next-auth.md @@ -158,8 +158,8 @@ El uso de NextAuth.js con el middleware Next.js [requiere el uso de la estrategi 1. Dirígete a [la sección de aplicaciones en el portal del desarrollador de Discord](https://discord.com/developers/applications) y haz clic en "New Application" 2. En el menú de configuración, dirígite a "OAuth2 => General" -- Copia el Client ID y pégalo en `DISCORD_CLIENT_ID` en `.env`. -- En Client Secret, haz clic en "Reset Secret" y copia ese string en `DISCORD_CLIENT_SECRET` en `.env`. Ten cuidado ya que no podrás volver a ver este valor secreto, y restablecerlo hará que el existente expire. +- Copia el Client ID y pégalo en `AUTH_DISCORD_ID` en `.env`. +- En Client Secret, haz clic en "Reset Secret" y copia ese string en `AUTH_DISCORD_SECRET` en `.env`. Ten cuidado ya que no podrás volver a ver este valor secreto, y restablecerlo hará que el existente expire. - Haz clic en "Add Redirect" y pega en `/api/auth/callback/discord` (Ejemplo para desarrollo local: http://localhost:3000/api/auth/callback/discord) - Guarda tus cambios - Es posible, pero no recomendado, usar la misma aplicación de Discord tanto para desarrollo como para producción. También puedes considerar hacer un [mock del proveedor](https://github.com/trpc/trpc/blob/main/examples/next-prisma-websockets-starter/src/pages/api/auth/%5B...nextauth%5D.ts) durante el desarrollo. diff --git a/www/src/pages/fr/folder-structure-pages.mdx b/www/src/pages/fr/folder-structure-pages.mdx index cd85a7e057..bf54572dd2 100644 --- a/www/src/pages/fr/folder-structure-pages.mdx +++ b/www/src/pages/fr/folder-structure-pages.mdx @@ -197,9 +197,9 @@ Le fichier `next.config.mjs` est utilisé pour configurer Next.js. Voir la [docu
-### `postcss.config.cjs` +### `postcss.config.js` -Le fichier `postcss.config.cjs` est utilisé pour l'utilisation de Tailwind PostCSS. Voir la [documentation de Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) pour plus d'informations. +Le fichier `postcss.config.js` est utilisé pour l'utilisation de Tailwind PostCSS. Voir la [documentation de Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) pour plus d'informations.
diff --git a/www/src/pages/fr/usage/first-steps.md b/www/src/pages/fr/usage/first-steps.md index bcb70548f6..34202c35af 100644 --- a/www/src/pages/fr/usage/first-steps.md +++ b/www/src/pages/fr/usage/first-steps.md @@ -21,12 +21,11 @@ Bien sûr, si vous préférez utiliser un autre fournisseur d'authentification, 1. Vous aurez besoin d'un compte Discord, créez-en un si vous ne l'avez pas déjà fait. 2. Accédez à https://discord.com/developers/applications et cliquez sur "New Application" dans le coin supérieur droit. Nommez votre application et acceptez les conditions d'utilisation. 3. Une fois votre application créée, accédez à "Settings → OAuth2 → General". -4. Copiez le "Client ID" et ajoutez-le à votre `.env` en tant que `DISCORD_CLIENT_ID`. +4. Copiez le "Client ID" et ajoutez-le à votre `.env` en tant que `AUTH_DISCORD_ID`. 5. Cliquez sur "Reset Secret", copiez le nouveau secret et ajoutez-le à votre `.env` en tant que `DISCORD CLIENT_SECRET`. 6. Cliquez sur "Add Redirect" et saisissez `http://localhost:3000/api/auth/callback/discord`. - Pour le déploiement en production, suivez les étapes précédentes pour créer une autre application Discord, mais cette fois remplacez `http://localhost:3000` par l'URL vers laquelle vous déployez. 7. Sauvegarder les modifications. -8. Définissez `NEXTAUTH_SECRET` dans `.env`. En développement, n'importe quelle chaîne fonctionnera, pour la production, voir la note dans `.env` sur la génération d'un secret sécurisé. Vous devriez maintenant pouvoir vous connecter. diff --git a/www/src/pages/fr/usage/next-auth.mdx b/www/src/pages/fr/usage/next-auth.mdx index a26bf858c9..cb263a78f6 100644 --- a/www/src/pages/fr/usage/next-auth.mdx +++ b/www/src/pages/fr/usage/next-auth.mdx @@ -212,7 +212,7 @@ Ex.: 1. Rendez-vous dans [la section Applications du portail des développeurs Discord](https://discord.com/developers/applications), et cliquez sur "New Application" 1. Dans le menu des paramètres, allez dans "OAuth2 => General" -- Copiez l'ID client et collez-le dans `DISCORD_CLIENT_ID` dans `.env`. +- Copiez l'ID client et collez-le dans `AUTH_DISCORD_ID` dans `.env`. - Sous Client Secret, cliquez sur "Reset Secret" et copiez cette chaîne de caractères dans `DISCORD CLIENT_SECRET` dans `.env`. Soyez prudent car vous ne pourrez plus voir ce secret et le réinitialiser entraînera l'expiration du secret existant. - Cliquez sur "Add Redirect" et collez `/api/auth/callback/discord` (exemple pour le développement local : http://localhost:3000/api/auth/rappel/discord) - Enregistrez vos modifications diff --git a/www/src/pages/ja/folder-structure-pages.mdx b/www/src/pages/ja/folder-structure-pages.mdx index 649ad650f7..57482b1024 100644 --- a/www/src/pages/ja/folder-structure-pages.mdx +++ b/www/src/pages/ja/folder-structure-pages.mdx @@ -187,9 +187,9 @@ import Form from "../../components/docs/folderStructureForm.astro";
-### `postcss.config.cjs` +### `postcss.config.js` -Tailwind の PostCSS の利用には、`postcss.config.cjs`ファイルが使用されます。詳しくは[Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss)を参照してください。 +Tailwind の PostCSS の利用には、`postcss.config.js`ファイルが使用されます。詳しくは[Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss)を参照してください。
diff --git a/www/src/pages/ja/usage/first-steps.md b/www/src/pages/ja/usage/first-steps.md index e3c61ca816..e0563e2734 100644 --- a/www/src/pages/ja/usage/first-steps.md +++ b/www/src/pages/ja/usage/first-steps.md @@ -20,14 +20,13 @@ lang: ja 1. Discord のアカウントが必要になりますので、まだの方は登録してください。 2. https://discord.com/developers/applications に移動し、右上の「New Application」をクリックします。アプリケーションの名前を付け、利用規約に同意してください。 3. アプリケーションの作成が完了したら、「Settings → OAuth2 → General」に移動してください。 -4. 「Client ID」をコピーし、`DISCORD_CLIENT_ID`として`.env`に追加します。 -5. 「Reset Secret」をクリックし、新しいシークレット情報をコピーし、`DISCORD_CLIENT_SECRET`として`.env`に追加します。 +4. 「Client ID」をコピーし、`AUTH_DISCORD_ID`として`.env`に追加します。 +5. 「Reset Secret」をクリックし、新しいシークレット情報をコピーし、`AUTH_DISCORD_SECRET`として`.env`に追加します。 6. 「Add Redirect」をクリックし、`http://localhost:3000/api/auth/callback/discord`と入力します。 - 本番環境でのデプロイの場合は、前述の手順で別の Discord アプリケーションを作成しますが、今回は`http://localhost:3000`をデプロイ先の URL で置き換えてください。 7. 変更を保存します。 -8. `.env`に`NEXTAUTH_SECRET`を設定します。開発環境では任意の文字列が機能しますが、本番環境では`.env`内のセキュアなシークレット情報の生成に関する注意事項を参照してください。 これでログインできるようになります。 diff --git a/www/src/pages/ja/usage/next-auth.md b/www/src/pages/ja/usage/next-auth.md index 0932878cb4..5cc13c61df 100644 --- a/www/src/pages/ja/usage/next-auth.md +++ b/www/src/pages/ja/usage/next-auth.md @@ -181,8 +181,8 @@ NextAuth.js を Next.js ミドルウェアで利用する場合、認証に [JWT 1. [Discord Developer Portal の Application セクション](https://discord.com/developers/applications)に向かい「New Application」をクリックします。 2. 設定メニューの 「OAuth2 ⇒ General」に行きます -- Client ID をコピーして、`.env`の`DISCORD_CLIENT_ID`に貼り付けます。 -- Client Secret の下にある 「Reset Secret」をクリックし、その文字列を`.env`の`DISCORD_CLIENT_SECRET`にコピーしてください。このシークレット情報は二度と表示されないことと、リセットすると既存のシークレット情報は失効してしまうことについて注意してください。 +- Client ID をコピーして、`.env`の`AUTH_DISCORD_ID`に貼り付けます。 +- Client Secret の下にある 「Reset Secret」をクリックし、その文字列を`.env`の`AUTH_DISCORD_SECRET`にコピーしてください。このシークレット情報は二度と表示されないことと、リセットすると既存のシークレット情報は失効してしまうことについて注意してください。 - 「Add Redirect」をクリックし、`/api/auth/callback/discord` を貼り付ける(ローカル開発サーバの場合の例:http://localhost:3000/api/auth/callback/discord) - 変更を保存します - 開発用と本番用で同じ Discord Application を使用できますが、推奨はしません。また、開発時には[プロバイダをモックする](https://github.com/trpc/trpc/blob/main/examples/next-prisma-websockets-starter/src/pages/api/auth/%5B...nextauth%5D.ts)こと検討するのもよいでしょう。 diff --git a/www/src/pages/no/folder-structure-pages.mdx b/www/src/pages/no/folder-structure-pages.mdx index 5d08f774cf..b77fd3820c 100644 --- a/www/src/pages/no/folder-structure-pages.mdx +++ b/www/src/pages/no/folder-structure-pages.mdx @@ -183,9 +183,9 @@ Basert på dine valgte pakker inneholder denne ruteren flere eller færre ruter
-### `postcss.config.cjs` +### `postcss.config.js` -`postcss.config.cjs`-filen er for bruk av Tailwind PostCSS. Se [Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss) for mer informasjon. +`postcss.config.js`-filen er for bruk av Tailwind PostCSS. Se [Tailwind PostCSS Docs](https://tailwindcss.com/docs/installation/using-postcss) for mer informasjon.
diff --git a/www/src/pages/no/usage/first-steps.md b/www/src/pages/no/usage/first-steps.md index 7b55643071..c7fbd7eb0d 100644 --- a/www/src/pages/no/usage/first-steps.md +++ b/www/src/pages/no/usage/first-steps.md @@ -20,12 +20,11 @@ Hvis du foretrekker en annen autentiseringsleverandør, kan du også bruke en av 1. Du trenger en Discord-konto. Meld deg på hvis du ikke har en ennå. 2. Naviger til https://discord.com/developers/applications og klikk "New Application" øverst til høyre. Gi applikasjonen din et navn og godta vilkårene for bruk. 3. Når applikasjonen din er opprettet, naviger til "Settings → OAuth2 → General". -4. Kopier "Client ID" og lim den inn i `.env` som `DISCORD_CLIENT_ID`. -5. Klikk "Reset Secret", kopier den nye hemmeligheten og lim inn verdien i `.env` som `DISCORD_CLIENT_SECRET`. +4. Kopier "Client ID" og lim den inn i `.env` som `AUTH_DISCORD_ID`. +5. Klikk "Reset Secret", kopier den nye hemmeligheten og lim inn verdien i `.env` som `AUTH_DISCORD_SECRET`. 6. Klikk "Add Redirect" og skriv inn `http://localhost:3000/api/auth/callback/discord`. - For utrulling i produksjonsmiljø må de foregående trinnene følges på nytt for å lage en annen Discord-applikasjon. Denne gangen erstatt `http://localhost:3000` med URL-en du publiserer til. 7. Lagre endringene. -8. Skriv `NEXTAUTH_SECRET` i `.env`. Hvilken som helst streng vil fungere under utviklingen. For bruk i produksjonsmiljø, ta en titt på notatet i `.env` for å lage en sikker hemmelighetvariabel. Du skal nå kunne logge på. diff --git a/www/src/pages/no/usage/next-auth.md b/www/src/pages/no/usage/next-auth.md index f5f922aacf..a1deed32d7 100644 --- a/www/src/pages/no/usage/next-auth.md +++ b/www/src/pages/no/usage/next-auth.md @@ -179,8 +179,8 @@ Bruk av NextAuth.js med Next.js middleware [krever bruk av "JWT session strategy 2. Bytt til "OAuth2 => Generelt" i settings-menyen -- Kopier klient-ID-en og lim den inn i `DISCORD_CLIENT_ID` i `.env`. -- Under Client Secret, klikk på "Reset Secret" og kopier denne strengen til `DISCORD_CLIENT_SECRET` i `.env`. Vær forsiktig siden du ikke lenger vil kunne se denne hemmeligheten og tilbakestilling av den vil føre til at den eksisterende hemmeligheten utløper. +- Kopier klient-ID-en og lim den inn i `AUTH_DISCORD_ID` i `.env`. +- Under Client Secret, klikk på "Reset Secret" og kopier denne strengen til `AUTH_DISCORD_SECRET` i `.env`. Vær forsiktig siden du ikke lenger vil kunne se denne hemmeligheten og tilbakestilling av den vil føre til at den eksisterende hemmeligheten utløper. - Klikk på "Add Redirect" og lim inn `/api/auth/callback/discord` (eksempel for utvikling i lokal miljø: http://localhost:3000/api/auth/callback/discord) - Lagre endringene dine - Det er mulig, men ikke anbefalt, å bruke samme Discord-applikasjon for utvikling og produksjon. Du kan også vurdere å [Mocke leverandøren](https://github.com/trpc/trpc/blob/main/examples/next-prisma-websockets-starter/src/pages/api/auth/%5B...nextauth%5D.ts) under utviklingen. diff --git a/www/src/pages/pl/folder-structure-pages.mdx b/www/src/pages/pl/folder-structure-pages.mdx index 1a57fcdf80..0d935b79c6 100644 --- a/www/src/pages/pl/folder-structure-pages.mdx +++ b/www/src/pages/pl/folder-structure-pages.mdx @@ -184,9 +184,9 @@ Plik `next.config.mjs` jest używany do konfigurowania Next.js. Po więcej infor
-### `postcss.config.cjs` +### `postcss.config.js` -Plik `postcss.config.cjs` jest używany przez Tailwind PostCSS. Po więcej informacji, zobacz [dokumentację Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss). +Plik `postcss.config.js` jest używany przez Tailwind PostCSS. Po więcej informacji, zobacz [dokumentację Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss).
diff --git a/www/src/pages/pl/usage/first-steps.md b/www/src/pages/pl/usage/first-steps.md index f153968a6a..20ae6806d7 100644 --- a/www/src/pages/pl/usage/first-steps.md +++ b/www/src/pages/pl/usage/first-steps.md @@ -26,14 +26,14 @@ Oczywiście, jeżeli wolisz korzystać z innego, możesz użyć jednego z [wielu 1. Potrzebować będziesz konta Discord, więc utwórz je, jeśli jeszcze tego nie zrobiłeś. 2. Przejdź do strony https://discord.com/developers/applications i kliknij "New Appliction" w prawym górnym rogu. Nazwij ją i wyraź zgodę na warunki korzystania z serwisu. 3. Po stworzeniu aplikacji, przejdź do "Settings → OAuth2 → General". -4. Skopiuj "Client ID" i dodaj go do pliku `.env` pod kluczem `DISCORD_CLIENT_ID`. -5. Kliknij "Reset Secret", skopiuj nowy secret i dodaj go do pliku `.env` pod kluczem `DISCORD_CLIENT_SECRET`. +4. Skopiuj "Client ID" i dodaj go do pliku `.env` pod kluczem `AUTH_DISCORD_ID`. +5. Kliknij "Reset Secret", skopiuj nowy secret i dodaj go do pliku `.env` pod kluczem `AUTH_DISCORD_SECRET`. 6. Kliknij "Add Redirect" i wpisz `http://localhost:3000/api/auth/callback/discord`. - Dla deploymentu w wersji produkcyjnej, podążaj za powyższymi krokami aby stworzyć nową aplikację Discord, ale tym razem zamień `http://localhost:3000` na URL, na który wrzucasz swój projekt. 1. Zapisz zmiany -2. Ustaw `NEXTAUTH_SECRET` w pliku `.env`. W wersji rozwojowej zadziała byle co, w wersji produkcyjnej zobacz uwagę w pliku `.env`, która mówi, jak wygenerować bezpieczny secret. +2. Ustaw `AUTH_SECRET` w pliku `.env`. W wersji rozwojowej zadziała byle co, w wersji produkcyjnej zobacz uwagę w pliku `.env`, która mówi, jak wygenerować bezpieczny secret. Powinieneś być w stanie się zalogować. diff --git a/www/src/pages/pl/usage/next-auth.md b/www/src/pages/pl/usage/next-auth.md index cde1f0212d..d4a65135f3 100644 --- a/www/src/pages/pl/usage/next-auth.md +++ b/www/src/pages/pl/usage/next-auth.md @@ -178,8 +178,8 @@ Wykorzystanie middleware'a Next.js [wymaga od Ciebie skorzystania ze strategii J 1. Przejdź do [sekcji Aplikacje w Panelu Discord Developer Portal](https://discord.com/developers/applications), a następnie kliknij na "New Application" 2. W menu ustawień, przejdź do "OAuth2 => General" -- Skopiuj Client ID i wklej go do pliku `.env` pod kluczem `DISCORD_CLIENT_ID`. -- Pod Client Secret, kliknij "Reset Secret" i skopiuj podany tekst do pliku `.env` pod kluczem `DISCORD_CLIENT_SECRET`. Uważaj - nie będziesz mógł ponownie zobaczyć tego klucza, a jego reset spowoduje wygaśnięcie aktualnego. +- Skopiuj Client ID i wklej go do pliku `.env` pod kluczem `AUTH_DISCORD_ID`. +- Pod Client Secret, kliknij "Reset Secret" i skopiuj podany tekst do pliku `.env` pod kluczem `AUTH_DISCORD_SECRET`. Uważaj - nie będziesz mógł ponownie zobaczyć tego klucza, a jego reset spowoduje wygaśnięcie aktualnego. - Dodaj "Add Redirect" i wklej tam `/api/auth/callback/discord` (przykładowo dla lokalnej aplikacji: http://localhost:3000/api/auth/callback/discord) - Zapisz zmiany - Jest możliwość (nie jest ona jednak polecana), aby wykorzystać tą samą aplikację Discorda dla zarówno aplikacji lokalnej i tej w wersji produkcyjnej. Możesz także wykorzystać [mockowanie providera](https://github.com/trpc/trpc/blob/next/examples/next-prisma-starter-websockets/src/pages/api/auth/%5B...nextauth%5D.ts) podczas rozwoju aplikacji. diff --git a/www/src/pages/pt/folder-structure-pages.mdx b/www/src/pages/pt/folder-structure-pages.mdx index f88fdd5fe7..0dad871dfe 100644 --- a/www/src/pages/pt/folder-structure-pages.mdx +++ b/www/src/pages/pt/folder-structure-pages.mdx @@ -198,9 +198,9 @@ O arquivo `next.config.mjs` é usado para configura o Next.js. Veja [Documentaç
-### `postcss.config.cjs` +### `postcss.config.js` -O arquivo `postcss.config.cjs` é usado para o uso do Tailwind PostCSS. Veja [Documentação do Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) para mais informações. +O arquivo `postcss.config.js` é usado para o uso do Tailwind PostCSS. Veja [Documentação do Tailwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) para mais informações.
diff --git a/www/src/pages/pt/usage/first-steps.md b/www/src/pages/pt/usage/first-steps.md index a1ba2ef1f4..e20170e0bf 100644 --- a/www/src/pages/pt/usage/first-steps.md +++ b/www/src/pages/pt/usage/first-steps.md @@ -20,12 +20,11 @@ Claro, se você preferir usar um provedor de autenticação diferente, também p 1. Você precisará de uma conta no Discord, então crie uma se ainda não tiver. 2. Navegue até https://discord.com/developers/applications e clique em "Novo aplicativo" no canto superior direito. Dê um nome ao seu aplicativo e concorde com os Termos de Serviço. 3. Depois de criar seu aplicativo, navegue até "Configurações → OAuth2 → Geral". -4. Copie o "ID do cliente" e adicione-o ao seu `.env` como `DISCORD_CLIENT_ID`. -5. Clique em "Redefinir Segredo", copie o novo segredo e adicione-o ao seu `.env` como `DISCORD_CLIENT_SECRET`. +4. Copie o "ID do cliente" e adicione-o ao seu `.env` como `AUTH_DISCORD_ID`. +5. Clique em "Redefinir Segredo", copie o novo segredo e adicione-o ao seu `.env` como `AUTH_DISCORD_SECRET`. 6. Clique em "Adicionar redirecionamento" e digite `http://localhost:3000/api/auth/callback/discord`. - Para implantação de produção, siga as etapas anteriores para criar outro aplicativo Discord, mas desta vez substitua `http://localhost:3000` pela URL na qual você está implantando. 7. Salve as alterações. -8. Defina `NEXTAUTH_SECRET` em `.env`. Em desenvolvimento, qualquer string funcionará, para produção, veja a nota em `.env` sobre como gerar um segredo seguro. Agora você deve conseguir fazer login. diff --git a/www/src/pages/pt/usage/next-auth.md b/www/src/pages/pt/usage/next-auth.md index 074ff4edf5..8c68589e43 100644 --- a/www/src/pages/pt/usage/next-auth.md +++ b/www/src/pages/pt/usage/next-auth.md @@ -181,8 +181,8 @@ Uso de NextAuth.js com middleware Next.js [requer o uso da estratégia de sessã 1. Vá para [a seção Aplicativos no Portal do desenvolvedor do Discord](https://discord.com/developers/applications) e clique em "Novo aplicativo" 2. No menu de configurações, vá para "OAuth2 => Geral" -- Copie o Client ID e cole-o em `DISCORD_CLIENT_ID` em `.env`. -- Em Client Secret, clique em "Reset Secret" e copie essa string para `DISCORD_CLIENT_SECRET` em `.env`. Tenha cuidado, pois você não poderá ver esse segredo novamente e redefini-lo fará com que o existente expire. +- Copie o Client ID e cole-o em `AUTH_DISCORD_ID` em `.env`. +- Em Client Secret, clique em "Reset Secret" e copie essa string para `AUTH_DISCORD_SECRET` em `.env`. Tenha cuidado, pois você não poderá ver esse segredo novamente e redefini-lo fará com que o existente expire. - Clique em "Add Redirect" e cole em `/api/auth/callback/discord` (exemplo para desenvolvimento local: http://localhost:3000/api/auth/callback/discord) - Salve suas alterações - É possível, mas não recomendado, usar o mesmo aplicativo Discord tanto para desenvolvimento quanto para produção. Você também pode considerar [mockar o Provider](https://github.com/trpc/trpc/blob/next/examples/next-prisma-starter-websockets/src/pages/api/auth/%5B...nextauth%5D.ts) durante o desenvolvimento. diff --git a/www/src/pages/ru/folder-structure-pages.mdx b/www/src/pages/ru/folder-structure-pages.mdx index 16e12e3b47..4ecfa05442 100644 --- a/www/src/pages/ru/folder-structure-pages.mdx +++ b/www/src/pages/ru/folder-structure-pages.mdx @@ -198,9 +198,9 @@ import Form from "../../components/docs/folderStructureForm.astro";
-### `postcss.config.cjs` +### `postcss.config.js` -Файл `postcss.config.cjs` используется для использования Tailwind PostCSS. Смотрите [документацию Taiwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) для получения дополнительной информации. +Файл `postcss.config.js` используется для использования Tailwind PostCSS. Смотрите [документацию Taiwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) для получения дополнительной информации.
diff --git a/www/src/pages/ru/usage/first-steps.md b/www/src/pages/ru/usage/first-steps.md index ba31d9cd65..059c2bee3f 100644 --- a/www/src/pages/ru/usage/first-steps.md +++ b/www/src/pages/ru/usage/first-steps.md @@ -20,12 +20,11 @@ lang: ru 1. Вам нужен аккаунт Discord, поэтому зарегистрируйтесь, если еще не зарегистрировались. 2. Перейдите на https://discord.com/developers/applications и нажмите «New Application» в правом верхнем углу. Дайте вашему приложению имя и согласитесь с Условиями использования. 3. Когда вы создадите приложение, перейдите к «Settings → OAuth2 → General». -4. Скопируйте «Client ID» и добавьте его в ваш `.env` как `DISCORD_CLIENT_ID`. -5. Нажмите «Reset Secret», скопируйте новый секрет и добавьте его в ваш `.env` как `DISCORD_CLIENT_SECRET`. +4. Скопируйте «Client ID» и добавьте его в ваш `.env` как `AUTH_DISCORD_ID`. +5. Нажмите «Reset Secret», скопируйте новый секрет и добавьте его в ваш `.env` как `AUTH_DISCORD_SECRET`. 6. Нажмите «Add Redirect» и введите `http://localhost:3000/api/auth/callback/discord`. - Для развертывания в продакшене следуйте предыдущим шагам для создания другого приложения Discord, но на этот раз замените `http://localhost:3000` на URL, на который вы развертываете. 7. Сохраните изменения. -8. Установите `NEXTAUTH_SECRET` в `.env`. В разработке любая строка будет работать, для продакшена см. Примечание в `.env` о генерации безопасного секрета. Теперь у вас должна быть возможность войти в систему. diff --git a/www/src/pages/ru/usage/next-auth.md b/www/src/pages/ru/usage/next-auth.md index 98f82d79b0..f6c19e5bd1 100644 --- a/www/src/pages/ru/usage/next-auth.md +++ b/www/src/pages/ru/usage/next-auth.md @@ -181,8 +181,8 @@ const userRouter = router({ 1. Перейдите в [раздел Applications в Discord Developer Portal](https://discord.com/developers/applications), и нажмите на "New Application" 2. В меню настроек перейдите к "OAuth2 => General" -- Скопируйте Client ID и вставьте его в `DISCORD_CLIENT_ID` в `.env`. -- Возле Client Secret нажмите "Reset Secret" и скопируйте эту строку в `DISCORD_CLIENT_SECRET` в `.env`. Будьте осторожны, поскольку вы больше не сможете увидеть этот секрет, и сброс его приведет к тому, что существующий истечет. +- Скопируйте Client ID и вставьте его в `AUTH_DISCORD_ID` в `.env`. +- Возле Client Secret нажмите "Reset Secret" и скопируйте эту строку в `AUTH_DISCORD_SECRET` в `.env`. Будьте осторожны, поскольку вы больше не сможете увидеть этот секрет, и сброс его приведет к тому, что существующий истечет. - Нажмите "Add Redirect" и вставьте `/api/auth/callback/discord` (пример для локальной разработки: http://localhost:3000/api/auth/callback/discord) - Сохраните изменения - Возможно, но не рекомендуется, использовать одно и то же приложение Discord для разработки и продакшена. Вы также можете рассмотреть [Mocking the Provider](https://github.com/trpc/trpc/blob/next/examples/next-prisma-starter-websockets/src/pages/api/auth/%5B...nextauth%5D.ts) во время разработки. diff --git a/www/src/pages/uk/folder-structure-pages.mdx b/www/src/pages/uk/folder-structure-pages.mdx index 9fdbedf015..bb1662d4bf 100644 --- a/www/src/pages/uk/folder-structure-pages.mdx +++ b/www/src/pages/uk/folder-structure-pages.mdx @@ -198,9 +198,9 @@ import Form from "../../components/docs/folderStructureForm.astro";
-### `postcss.config.cjs` +### `postcss.config.js` -Файл `postcss.config.cjs` використовується для використання Tailwind PostCSS. Дивіться [документацію Taiwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) для отримання додаткової інформації. +Файл `postcss.config.js` використовується для використання Tailwind PostCSS. Дивіться [документацію Taiwind PostCSS](https://tailwindcss.com/docs/installation/using-postcss) для отримання додаткової інформації.
diff --git a/www/src/pages/uk/usage/first-steps.md b/www/src/pages/uk/usage/first-steps.md index 93166bd242..710028fb77 100644 --- a/www/src/pages/uk/usage/first-steps.md +++ b/www/src/pages/uk/usage/first-steps.md @@ -30,12 +30,11 @@ lang: uk 1. Вам потрібен обліковий запис Discord, тому зареєструйтеся, якщо ще не зареєструвалися. 2. Перейдіть на https://discord.com/developers/applications і натисніть "New Application" у правому верхньому куті. Дайте вашому додатку ім'я та погодьтеся з Умовами використання. 3. Коли ви створите додаток, перейдіть до "Settings → OAuth2 → General". -4. Скопіюйте "Client ID" і додайте його у ваш `.env` як `DISCORD_CLIENT_ID`. -5. Натисніть "Reset Secret", скопіюйте новий secret і додайте його у ваш `.env` як `DISCORD_CLIENT_SECRET`. +4. Скопіюйте "Client ID" і додайте його у ваш `.env` як `AUTH_DISCORD_ID`. +5. Натисніть "Reset Secret", скопіюйте новий secret і додайте його у ваш `.env` як `AUTH_DISCORD_SECRET`. 6. Натисніть "Add Redirect" і введіть `http://localhost:3000/api/auth/callback/discord`. - Для деплойменту в продакшені дотримуйтесь попередніх кроків для створення іншого додатка Discord, але цього разу замініть `http://localhost:3000` на URL, на який ви деплоїте. 7. Збережіть зміни. -8. Встановіть `NEXTAUTH_SECRET` у `.env`. У розробці будь-який рядок працюватиме, для продакшена див. примітка в `.env` про генерацію безпечного secret. Тепер у вас має бути можливість увійти в систему. diff --git a/www/src/pages/uk/usage/next-auth.mdx b/www/src/pages/uk/usage/next-auth.mdx index 908a82c9d8..c311d37b2a 100644 --- a/www/src/pages/uk/usage/next-auth.mdx +++ b/www/src/pages/uk/usage/next-auth.mdx @@ -215,8 +215,8 @@ const userRouter = router({ 1. Перейдіть до розділу Applications у [Discord Developer Portal](https://discord.com/developers/applications) і натисніть "New Application" 2. У меню налаштувань перейдіть до "OAuth2 => General" -- Скопіюйте Client ID і вставте його в `DISCORD_CLIENT_ID` у `.env`. -- Біля Client Secret натисніть "Reset Secret" і скопіюйте цей рядок у `DISCORD_CLIENT_SECRET` у `.env`. Будьте обережними, оскільки ви більше не зможете побачити цей secret, і скидання його призведе до того, що існуючий протермінується. +- Скопіюйте Client ID і вставте його в `AUTH_DISCORD_ID` у `.env`. +- Біля Client Secret натисніть "Reset Secret" і скопіюйте цей рядок у `AUTH_DISCORD_SECRET` у `.env`. Будьте обережними, оскільки ви більше не зможете побачити цей secret, і скидання його призведе до того, що існуючий протермінується. - Натисніть "Add Redirect" і вставте `/api/auth/callback/discord` (приклад для локальної розробки: http://localhost:3000/api/auth/callback/discord) - Збережіть зміни - Можливо, але не рекомендується, використовувати один і той же додаток Discord для розробки та продакшену. Ви також можете розглянути [Mocking the Provider](https://github.com/trpc/trpc/blob/main/examples/next-prisma-websockets-starter/src/pages/api/auth/%5B...nextauth%5D.ts) під час розробки. diff --git a/www/src/pages/zh-hans/folder-structure-pages.mdx b/www/src/pages/zh-hans/folder-structure-pages.mdx index 3ceb055d52..ce2fb44ad8 100644 --- a/www/src/pages/zh-hans/folder-structure-pages.mdx +++ b/www/src/pages/zh-hans/folder-structure-pages.mdx @@ -185,9 +185,9 @@ root.ts 文件用于合并 tRPC 子路由并将它们导出为一个单一的路
-### `postcss.config.cjs` +### `postcss.config.js` -文件 `postcss.config.cjs` 被用于配置 Tailwind PostCSS 的用法。参看 [Tailwind PostCSS 文档](https://tailwindcss.com/docs/installation/using-postcss) 来了解更多。 +文件 `postcss.config.js` 被用于配置 Tailwind PostCSS 的用法。参看 [Tailwind PostCSS 文档](https://tailwindcss.com/docs/installation/using-postcss) 来了解更多。
diff --git a/www/src/pages/zh-hans/usage/first-steps.md b/www/src/pages/zh-hans/usage/first-steps.md index b893e1ee78..29c7bf4f0f 100644 --- a/www/src/pages/zh-hans/usage/first-steps.md +++ b/www/src/pages/zh-hans/usage/first-steps.md @@ -24,12 +24,11 @@ lang: zh-hans 1. 你将需要一个 Discord 账号,所以如果你没有,请先注册一个。 2. 前往 然后在右上角点击 "New Application"。给你的应用创建一个名称,并同意相关的服务条款。 3. 当你的应用被创建后,前往 "Settings → OAuth2 → General"。 -4. 复制 "Client ID" 然后作为 `DISCORD_CLIENT_ID` 添加到 `.env`。 -5. 点击 "Reset Secret",复制新的密钥,然后作为 `DISCORD_CLIENT_SECRET` 添加到 `.env`。 +4. 复制 "Client ID" 然后作为 `AUTH_DISCORD_ID` 添加到 `.env`。 +5. 点击 "Reset Secret",复制新的密钥,然后作为 `AUTH_DISCORD_SECRET` 添加到 `.env`。 6. 点击 "Add Redirect",然后输入 `http://localhost:3000/api/auth/callback/discord`。 - 对于生产环境的部署,按照之前的步骤来创建另一个 Discord 应用,但是这一次将链接 `http://localhost:3000` 替换为实际生产环境的链接。 7. 保存你的更改。 -8. 在 `.env` 中设置 `NEXTAUTH_SECRET`。在开发过程中,任何字符串都能起效,但对于生产环境,记得查看 `.env` 文件中关于生成安全密钥的注释。 你现在应该可以登入到你的应用中了。 diff --git a/www/src/pages/zh-hans/usage/next-auth.mdx b/www/src/pages/zh-hans/usage/next-auth.mdx index 6b82a4eaec..c17c4d21bc 100644 --- a/www/src/pages/zh-hans/usage/next-auth.mdx +++ b/www/src/pages/zh-hans/usage/next-auth.mdx @@ -212,8 +212,8 @@ const userRouter = router({ 1. 前往 [Discord 开发者页面的应用部分](https://discord.com/developers/applications),然后点击 "New Application" 2. 在设置菜单中,依次前往 "OAuth2 => General" -- 复制 Client ID,然后粘贴到 `.env` 文件中的 `DISCORD_CLIENT_ID`。 -- 在 Client Secret 下方,点击 "Reset Secret",然后复制该字符串到 `env` 中的 `DISCORD_CLIENT_SECRET`。务必要细心,因为你无法再次查看该密钥了,而将它重置会让现存的密钥失效。 +- 复制 Client ID,然后粘贴到 `.env` 文件中的 `AUTH_DISCORD_ID`。 +- 在 Client Secret 下方,点击 "Reset Secret",然后复制该字符串到 `env` 中的 `AUTH_DISCORD_SECRET`。务必要细心,因为你无法再次查看该密钥了,而将它重置会让现存的密钥失效。 - 点击 "Add Redirect",然后将你应用的网址替换 `/api/auth/callback/discord` 里的 ``(例如,一个开发阶段的完整链接像这样:http://localhost:3000/api/auth/callback/discord) - 保存你的更改 - 在开发和生产环境使用同一个 Discord 应用是可行的,但不鼓励这么做。你应该也考虑在开发阶段 [模拟认证服务](https://github.com/trpc/trpc/blob/main/examples/next-prisma-websockets-starter/src/pages/api/auth/%5B...nextauth%5D.ts)。