Thank you for this great bit of code! I am having a problem validating, however.
I created a jwt on the command line using php. I validated it via the jwt.io debugger. I am reading it into my application then passing it into an instanteation of your QJsonWebToken class through ::fromTokenAndSecret(). The header and payload are correct but when I call isValid(), it returns false.
By stepping through, I noticed that the call for getHeaderQStr( JsonDocument::Compact ) made from getSignature() which is made by isValid() returns a header QString this already diffferent than the header that is in the original JWT.
I noticed that when the header is first read, the format is QJsonDocument::Indented and during the validation, the header is encoded with QJsonDocument::Compact. Changing that to ::Indented in both cases did not correct the issue.
Below is my JWT
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOiIyMDE3LTA5LTIyVDE5OjAzOjUyLTA0OjAwIiwiaXNzIjoiQWRkIEhhcHRpY3MiLCJleHAiOiIyMDE4LTA5LTIyVDE5OjAzOjUyLTA0OjAwIiwiYXVkIjoibWlrZS5ncmVlbmlzaEBhZGRoYXB0aWNzLmNvbSIsImRhdGEiOnsiY2lkIjoiMTMyMDEwODAwMCIsImxpY19pZCI6IjUiLCJtb2R1bGVzIjoxfX0.E42BptdM4nqmv-LDuMGIzsYnHjQRrvS0OScc4ctzDen8KAsfba9vQ2OVjveSDz0po6Ynm6lLjzkSnXnLNavH7Q
I am using base64 encoding
Any help you could provide with figuring out what I am doing wrong would be greatly appreciated.
Thank you for this great bit of code! I am having a problem validating, however.
I created a jwt on the command line using php. I validated it via the jwt.io debugger. I am reading it into my application then passing it into an instanteation of your QJsonWebToken class through ::fromTokenAndSecret(). The header and payload are correct but when I call isValid(), it returns false.
By stepping through, I noticed that the call for getHeaderQStr( JsonDocument::Compact ) made from getSignature() which is made by isValid() returns a header QString this already diffferent than the header that is in the original JWT.
I noticed that when the header is first read, the format is QJsonDocument::Indented and during the validation, the header is encoded with QJsonDocument::Compact. Changing that to ::Indented in both cases did not correct the issue.
Below is my JWT
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOiIyMDE3LTA5LTIyVDE5OjAzOjUyLTA0OjAwIiwiaXNzIjoiQWRkIEhhcHRpY3MiLCJleHAiOiIyMDE4LTA5LTIyVDE5OjAzOjUyLTA0OjAwIiwiYXVkIjoibWlrZS5ncmVlbmlzaEBhZGRoYXB0aWNzLmNvbSIsImRhdGEiOnsiY2lkIjoiMTMyMDEwODAwMCIsImxpY19pZCI6IjUiLCJtb2R1bGVzIjoxfX0.E42BptdM4nqmv-LDuMGIzsYnHjQRrvS0OScc4ctzDen8KAsfba9vQ2OVjveSDz0po6Ynm6lLjzkSnXnLNavH7Q
I am using base64 encoding
Any help you could provide with figuring out what I am doing wrong would be greatly appreciated.