Skip to content

Commit

Permalink
docs(auth): fix iron-session example url + API (#31413)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vvo committed Nov 15, 2021
1 parent a479557 commit 7d82e07
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions docs/authentication.md
Expand Up @@ -48,7 +48,7 @@ const 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

Expand All @@ -71,10 +71,7 @@ import withSession from '../lib/session'
import Layout from '../components/Layout'

export const getServerSideProps = withSession(async function ({ req, res }) {
// Get the user's session based on the request
const user = req.session.get('user')

if (!user) {
if (!req.session.user) {
return {
redirect: {
destination: '/login',
Expand Down

0 comments on commit 7d82e07

Please sign in to comment.