dwyl/hapi-auth-jwt2

Clarifying Questions (and Answers!) :-)

nelsonic opened this issue · 1 comments

We received the following question(s) by email1
replying here in case others have the same questions.

hapi-auth-jwt2-email-questions-1of2
hapi-auth-jwt2-email-questions-2of2

1Email is not the best way to ask questions because others who may have the same questions cannot learn from the answer if its only sent to one person.

Yes, you need to have the jsonwebtoken module in your node_modules so that you can sign tokens in your application.
Your validateFunction only validates if the JWT sent by the client is valid, in order to _create_ new JWTs in your application you need to have jsonwebtoken.

npm install jsonwebtoken --save

then you can simply var JWT = require('jsonwebtoken') above your jwtSign method and use it as described in the docs.
If unclear, please see: https://github.com/docdis/learn-json-web-tokens
for an example signing method see our "Real World Example" section in the Readme.

Thanks for the great question! 👍