Skip to content

Commit

Permalink
Auth0 V2 migration update (#45302)
Browse files Browse the repository at this point in the history
## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Hi Next.js team,  

This PR aims to update examples/auth0 with Auth0 V2 and fix profile api console error.

https://github.com/auth0/nextjs-auth0/blob/v2.0.0/V2_MIGRATION_GUIDE.md

Thanks for the review.
  • Loading branch information
mkcy3 committed Jun 15, 2023
1 parent e43f134 commit b09bbad
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/auth0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"start": "next start"
},
"dependencies": {
"@auth0/nextjs-auth0": "^1.9.1",
"@auth0/nextjs-auth0": "^2.2.0",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/auth0/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserProvider } from '@auth0/nextjs-auth0'
import { UserProvider } from '@auth0/nextjs-auth0/client'

export default function App({ Component, pageProps }) {
// optionally pass the 'user' prop from pages that require server-side
Expand Down
2 changes: 1 addition & 1 deletion examples/auth0/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useUser } from '@auth0/nextjs-auth0'
import { useUser } from '@auth0/nextjs-auth0/client'
import Layout from '../components/layout'

const About = () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/auth0/pages/advanced/api-profile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import { useUser } from '@auth0/nextjs-auth0'
import { useUser } from '@auth0/nextjs-auth0/client'
import Layout from '../../components/layout'

const ApiProfile = () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/auth0/pages/api/protected-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withApiAuthRequired, getSession } from '@auth0/nextjs-auth0'
// Protected API, requests to '/api/protected' without a valid session cookie will fail

async function handle(req, res) {
const { user } = getSession(req, res)
const { user } = await getSession(req, res)

try {
res.status(200).json({
Expand Down
2 changes: 1 addition & 1 deletion examples/auth0/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useUser } from '@auth0/nextjs-auth0'
import { useUser } from '@auth0/nextjs-auth0/client'
import Layout from '../components/layout'

const Home = () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/auth0/pages/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withPageAuthRequired } from '@auth0/nextjs-auth0'
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client'
import Layout from '../components/layout'
import { User } from '../interfaces'

Expand Down

0 comments on commit b09bbad

Please sign in to comment.