Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check payload is not null when decoded. #444

Merged
merged 3 commits into from
Apr 5, 2018
Merged

Conversation

Gp2mv3
Copy link
Contributor

@Gp2mv3 Gp2mv3 commented Feb 13, 2018

Fixed "Cannot read property 'nbf' of null" fixes #430

Fixed "Cannot read property 'nbf' of null"
decode.js Outdated
@@ -10,7 +10,7 @@ module.exports = function (jwt, options) {
if(typeof payload === 'string') {
try {
var obj = JSON.parse(payload);
if(typeof obj === 'object') {
if(obj && typeof obj === 'object') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test?

decode.js Outdated
@@ -10,7 +10,7 @@ module.exports = function (jwt, options) {
if(typeof payload === 'string') {
try {
var obj = JSON.parse(payload);
if(typeof obj === 'object') {
if(obj && typeof obj === 'object') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to check that obj !== null here instead? Might make it more clear that the additional condition is to guard against typeof null => 'object'.

@ziluvatar ziluvatar merged commit 1232ae9 into auth0:master Apr 5, 2018
@ziluvatar
Copy link
Contributor

ziluvatar commented Apr 5, 2018

@Gp2mv3 this has been released on v8.2.1 🎉

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check payload before trying to get nbf
3 participants