We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Same as this #1557.
Hi, I setup a new Next.js project (v14) and have been getting this error after following this guide up to this step.
Any help is appreciated. Thanks 😁
Set up a new app. npx create-next-app auth0-app
npx create-next-app auth0-app
Install dependencies npm install @auth0/nextjs-auth0
npm install @auth0/nextjs-auth0
Add .env.local with the correct appropriate values
.env.local
AUTH0_SECRET='use [openssl rand -hex 32] to generate a 32 bytes value' AUTH0_BASE_URL='http://localhost:3000' AUTH0_ISSUER_BASE_URL='https://{yourDomain}' AUTH0_CLIENT_ID='{yourClientId}' AUTH0_CLIENT_SECRET='{yourClientSecret}'
Add app/api/auth/[auth0]/route.ts
app/api/auth/[auth0]/route.ts
import { handleAuth } from '@auth0/nextjs-auth0'; export const GET = handleAuth();
Add UseProvider
UseProvider
import { UserProvider } from '@auth0/nextjs-auth0/client'; export default function RootLayout({ children }) { return ( <html lang="en"> <UserProvider> <body>{children}</body> </UserProvider> </html> ); }
Run the app
npm run dev
See this in the browser console.
package.json
{ "name": "auth0-app", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@auth0/nextjs-auth0": "^3.5.0", "next": "14.0.4", "react": "^18", "react-dom": "^18" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.0.4", "typescript": "^5" } }
layout.tsx
import { UserProvider } from '@auth0/nextjs-auth0/client'; import { ReactNode } from 'react'; export default async function RootLayout({ children }:{children:ReactNode}) { return ( <html lang="en"> <UserProvider> <body>{children}</body> </UserProvider> </html> ); }
@auth0/nextjs-auth0: "^3.5.0",
next: "14.0.4",
v20.10.0
The text was updated successfully, but these errors were encountered:
Tried this guide as well- https://developer.auth0.com/resources/guides/web-app/nextjs/basic-authentication.
Getting the same issue.
Sorry, something went wrong.
No branches or pull requests
Checklist
Description
Same as this #1557.
Hi,
I setup a new Next.js project (v14) and have been getting this error after following this guide up to this step.
Any help is appreciated. Thanks 😁
Reproduction
Set up a new app.
npx create-next-app auth0-app
Install dependencies
npm install @auth0/nextjs-auth0
Add
.env.local
with the correct appropriate valuesAdd
app/api/auth/[auth0]/route.ts
Add
UseProvider
Run the app
See this in the browser console.
Additional context
package.json
layout.tsx
nextjs-auth0 version
@auth0/nextjs-auth0: "^3.5.0",
Next.js version
next: "14.0.4",
Node.js version
v20.10.0
The text was updated successfully, but these errors were encountered: