Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
855 stars 233 forks source link

SYNC Time #265

Closed illegal-instruction-co closed 1 year ago

illegal-instruction-co commented 1 year ago

What's your question?

Sync time

Additional Context

If i want to use two ways jwt server -> client client -> server how can i sync times between them to use exp verification ? All clients can be use another time settings on windows.

prince-chrismc commented 1 year ago

This is a touch off topic since it's related to you application and deployment... the default answer is NTP. There's a lot of options https://en.m.wikipedia.org/wiki/Clock_synchronization though.

This library by default uses the system clock.

Some past related questions:

https://github.com/Thalhammer/jwt-cpp/issues/236 https://github.com/Thalhammer/jwt-cpp/issues/179#issuecomment-931582668

Thalhammer commented 1 year ago

All clients can be use another time settings on windows.

Assuming by "time settings" you mean the timezone, then it should be fine. The library converts local time to global (gmt) time which is identical regardless of the timezone a computer is in. Windows has a builtin network time feature that should be accurate enough for the tokens to be valid.

If by "time settings" you mean actually different times, than I wonder shortly, why and then agree with chris. NTP or the Windows builtin (which AFAIK uses ntp as well under the hood) are your best options.

prince-chrismc commented 1 year ago

I am going to close, if you have anything else don't hesitate to open an issue 🙂