Skip to content

Commit

Permalink
Fix Auth0 Example (#31284)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
stevejarvis committed Nov 11, 2021
1 parent ae1d271 commit 5014362
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/auth0/pages/advanced/ssr-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function getServerSideProps({ req, res }) {
// Here you can check authentication status directly before rendering the page,
// however the page would be a serverless function, which is more expensive and
// 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) {
res.writeHead(302, {
Expand Down

0 comments on commit 5014362

Please sign in to comment.