Skip to content

Commit

Permalink
fix(jwt): make decode overrideable in getToken (#1751)
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Apr 17, 2021
1 parent 17b7898 commit 457952b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/jwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ async function getToken (params) {
// or not set (e.g. development or test instance) case use unprefixed name
secureCookie = !(!process.env.NEXTAUTH_URL || process.env.NEXTAUTH_URL.startsWith('http://')),
cookieName = (secureCookie) ? '__Secure-next-auth.session-token' : 'next-auth.session-token',
raw = false
raw = false,
decode: _decode = decode
} = params
if (!req) throw new Error('Must pass `req` to JWT getToken()')

Expand All @@ -126,7 +127,7 @@ async function getToken (params) {
}

try {
return decode({ token, ...params })
return _decode({ token, ...params })
} catch {
return null
}
Expand Down

1 comment on commit 457952b

@vercel
Copy link

@vercel vercel bot commented on 457952b Apr 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.