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

iat and exp properties of decoded object are undefined #96

Closed
dev123dev123 opened this issue Jun 13, 2015 · 4 comments
Closed

iat and exp properties of decoded object are undefined #96

dev123dev123 opened this issue Jun 13, 2015 · 4 comments

Comments

@dev123dev123
Copy link

var token = jwt.sign('hello', secret, expiration);
var decoded = jwt.decode(token);

console.log(decoded.iat); // undefined
console.log(decoded.exp); // undefined

Not sure if iat and exp should display anything but undefined when a string payload is sent instead of an object.

@jfromaniello
Copy link
Member

The signed token in this case will not have exp/iat because it is an string. Try signing a JSON instead

@abhinav76
Copy link

@jfromaniello

var token=jwt.sign(member,app.get('superSecret'),{
expiresInMinutes:40
});

I am using this code to generate a token. members is the data from the database. and the token does not have iat and exp. what is wrong?

@jfromaniello
Copy link
Member

@abhinav76 please send me an example token

@jfromaniello
Copy link
Member

I added a note.

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

No branches or pull requests

3 participants