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

Sample code for generating jwtBody not working well #75

Open
hien-ngo opened this issue May 17, 2022 · 0 comments
Open

Sample code for generating jwtBody not working well #75

hien-ngo opened this issue May 17, 2022 · 0 comments

Comments

@hien-ngo
Copy link

jwtBody = "{\n\"digest\":\"" + digest + "\", \"digestAlgorithm\":\"SHA-256\", \"iat\":\"" + DateTime.Now.ToUniversalTime().ToString("r") + "\"}";

As you see in line 174, the code was performed manual JSON creation so when submitting the code to CYBS, it threw a bad_request error and I spend around half-day to identifying what is going wrong.
After that, I've found that the code block should be:
var obj = new { digest = digest, digestAlgorithm = "SHA-256", iat = DateTime.Now.ToUniversalTime().ToString("r") }; jwtBody = JsonConvert.SerializeObject(obj);
Because when you perform the code by using manual JSON, it was not correct when generating the JWT token, and it always thrown bad_request. After I changed it to above code block, it's working normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant