Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
9590a8a9
Unverified
Commit
9590a8a9
authored
May 02, 2020
by
Vincent Voyer
Committed by
GitHub
May 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(examples): upgrade next-iron-session to v4 (#12398)
parent
922b0ecc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
README.md
examples/with-iron-session/README.md
+5
-0
index.js
examples/with-iron-session/lib/session/index.js
+2
-1
package.json
examples/with-iron-session/package.json
+5
-5
No files found.
examples/with-iron-session/README.md
View file @
9590a8a9
...
...
@@ -12,6 +12,11 @@ It uses current best practices for authentication in the Next.js ecosystem.
-
Layout based on the user's logged-in/out status
-
Session data is signed and encrypted in a cookie
[
`next-iron-session`
](
https://github.com/vvo/next-iron-session
)
also supports:
-
Express / Connect middlewares
-
Multiple encryption keys (password) to allow for seamless updates or just password rotation
---
<p
align=
"center"
><b>
Online demo at
<a
href=
"https://next-iron-session.now.sh/"
>
https://next-iron-session.now.sh/
</a>
👀
</b></p>
...
...
examples/with-iron-session/lib/session/index.js
View file @
9590a8a9
// this file is a wrapper with defaults to be used in both API routes and `getServerSideProps` functions
import
withIronSession
from
'next-iron-session'
import
{
withIronSession
}
from
'next-iron-session'
export
default
function
withSession
(
handler
)
{
return
withIronSession
(
handler
,
{
...
...
@@ -7,6 +7,7 @@ export default function withSession(handler) {
// ⚠️ Do not reuse the same password, create a different password for you and store it in a secret management system
// Example for Zeit's now: https://vercel.com/docs/v2/serverless-functions/env-and-secrets
password
:
process
.
env
.
SECRET_COOKIE_PASSWORD
,
cookieName
:
'next.js/examples/with-iron-session'
,
cookieOptions
:
{
// the next line allows to use the session in non-https environements like
// Next.js dev mode (http://localhost:3000)
...
...
examples/with-iron-session/package.json
View file @
9590a8a9
...
...
@@ -8,12 +8,12 @@
"start"
:
"next start"
},
"dependencies"
:
{
"next"
:
"9.3.
0
"
,
"next-iron-session"
:
"
3.1
.0"
,
"next"
:
"9.3.
6
"
,
"next-iron-session"
:
"
4.0
.0"
,
"node-fetch"
:
"2.6.0"
,
"prop-types"
:
"15.7.2"
,
"react"
:
"16.13.
0
"
,
"react-dom"
:
"16.13.
0
"
,
"swr"
:
"0.
1.18
"
"react"
:
"16.13.
1
"
,
"react-dom"
:
"16.13.
1
"
,
"swr"
:
"0.
2.0
"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment