Unverified Commit 7d82e07d authored by Vincent Voyer's avatar Vincent Voyer Committed by GitHub

docs(auth): fix iron-session example url + API (#31413)

This fixes the iron-session example url from an old url to the new,
always-up-to-date url.

I believe the Next.js team owns the previous url but it's not up-to-date.

This commit also changes req.session.get("user") => req.session.user to reflect
the new API.
parent a4795571
...@@ -48,7 +48,7 @@ const Profile = () => { ...@@ -48,7 +48,7 @@ const Profile = () => {
export default Profile export default Profile
``` ```
You can view this [example in action](https://next-with-iron-session.vercel.app/). Check out the [`with-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session) example to see how it works. You can view this [example in action](https://iron-session-example.vercel.app/). Check out the [`with-iron-session`](https://github.com/vercel/next.js/tree/canary/examples/with-iron-session) example to see how it works.
### Authenticating Server-Rendered Pages ### Authenticating Server-Rendered Pages
...@@ -71,10 +71,7 @@ import withSession from '../lib/session' ...@@ -71,10 +71,7 @@ import withSession from '../lib/session'
import Layout from '../components/Layout' import Layout from '../components/Layout'
export const getServerSideProps = withSession(async function ({ req, res }) { export const getServerSideProps = withSession(async function ({ req, res }) {
// Get the user's session based on the request if (!req.session.user) {
const user = req.session.get('user')
if (!user) {
return { return {
redirect: { redirect: {
destination: '/login', destination: '/login',
......
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