Unverified Commit 5014362a authored by Steve Jarvis's avatar Steve Jarvis Committed by GitHub

Fix Auth0 Example (#31284)



Fixes #31286

I was going through the [Auth0 example](https://github.com/vercel/next.js/tree/canary/examples/auth0) and hit the following issue (screencap):

<img width="964" alt="Screen Shot 2021-11-10 at 12 57 41 PM" src="https://user-images.githubusercontent.com/2515575/141226775-08e5e1d3-618c-4fae-a133-70685c7b3ad2.png">

This just updates the call there to pass `res`, which matches the signature documented here: https://auth0.github.io/nextjs-auth0/modules/session_get_session.html

With this fix, the rest of the example worked wonderfully 👍.

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added (NA?)
- [x] Errors have helpful link attached, see `contributing.md`
parent ae1d271f
...@@ -21,7 +21,7 @@ export async function getServerSideProps({ req, res }) { ...@@ -21,7 +21,7 @@ export async function getServerSideProps({ req, res }) {
// Here you can check authentication status directly before rendering the page, // Here you can check authentication status directly before rendering the page,
// however the page would be a serverless function, which is more expensive and // however the page would be a serverless function, which is more expensive and
// slower than a static page with client side authentication // slower than a static page with client side authentication
const session = await auth0.getSession(req) const session = await auth0.getSession(req, res)
if (!session || !session.user) { if (!session || !session.user) {
res.writeHead(302, { res.writeHead(302, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment