jonasroussel / dart_jsonwebtoken

A dart implementation of the famous javascript library 'jsonwebtoken'
MIT License
87 stars 29 forks source link

IAT Custom #37

Closed yuriboeira11tx closed 1 year ago

yuriboeira11tx commented 1 year ago

Hello I wonder if there is any way to put the "iat" (issued at) key manually with this package? Apparently my server is delayed by a matter of milliseconds from the "iat" generated by the package. Any suggestions?

jonasroussel commented 1 year ago

Yes you can, iat is added during the sign method. You can simply add a custom iat inside your JWT payload and set to true the noIssueAt param of the sign method.

final jwt = JWT({ 'iat': 1674388 });
final token = jwt.sign(SecretKey('secret passphrase'), noIssueAt: true);