Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' of https://github.com/hanneslund/next.js into c…
…ache-google-requests
- Loading branch information
Showing
86 changed files
with
1,014 additions
and
676 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
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 |
---|---|---|
@@ -1,12 +1,5 @@ | ||
# Public Environment variables that can be used in the browser. | ||
NEXT_PUBLIC_AUTH0_CLIENT_ID=TEST | ||
NEXT_PUBLIC_AUTH0_SCOPE="openid profile" | ||
NEXT_PUBLIC_AUTH0_DOMAIN="http://example.com" | ||
NEXT_PUBLIC_BASE_URL="http://localhost:3000" | ||
NEXT_PUBLIC_REDIRECT_URI="/api/callback" | ||
NEXT_PUBLIC_POST_LOGOUT_REDIRECT_URI="/" | ||
|
||
# Secret environment variables only available to Node.js | ||
AUTH0_ISSUER_BASE_URL="https://" | ||
AUTH0_CLIENT_ID= | ||
AUTH0_CLIENT_SECRET= | ||
SESSION_COOKIE_SECRET= | ||
SESSION_COOKIE_LIFETIME=7200 | ||
AUTH0_BASE_URL="http://localhost:3000" | ||
AUTH0_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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import { UserProvider } from '@auth0/nextjs-auth0' | ||
|
||
export default function App({ Component, pageProps }) { | ||
// optionally pass the 'user' prop from pages that require server-side | ||
// rendering to prepopulate the 'useUser' hook. | ||
|
||
const { user } = pageProps | ||
|
||
return ( | ||
<UserProvider user={user}> | ||
<Component {...pageProps} /> | ||
</UserProvider> | ||
) | ||
} |
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
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,37 @@ | ||
import { useEffect, useState } from 'react' | ||
import { useUser } from '@auth0/nextjs-auth0' | ||
import Layout from '../../components/layout' | ||
|
||
const ApiProfile = () => { | ||
const { user, isLoading } = useUser() | ||
|
||
const [data, setData] = useState(null) | ||
|
||
useEffect(() => { | ||
;(async () => { | ||
const res = await fetch('/api/protected-api') | ||
|
||
const data = await res.json() | ||
|
||
setData(data) | ||
})() | ||
}, []) | ||
|
||
return ( | ||
<Layout user={user} loading={isLoading}> | ||
<h1>Profile</h1> | ||
|
||
<div> | ||
<h3>Public page (client rendered)</h3> | ||
<p>We are fetching data on the client-side :</p> | ||
<p>By making request to '/api/protected-api' serverless function</p> | ||
<p>so without a valid session cookie will fail</p> | ||
<p>{JSON.stringify(data)}</p> | ||
</div> | ||
</Layout> | ||
) | ||
} | ||
|
||
// Public route.(CSR) also accessing API from the client-side. | ||
// data is not cached when redirecting between pages. | ||
export default ApiProfile |
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
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,3 @@ | ||
import { handleAuth } from '@auth0/nextjs-auth0' | ||
|
||
export default handleAuth() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.