Generating query string hash for post requests

Hi,
i’m working on .Net plugin for jira and got some troubles with generating qsh. Instructions given here
https://developer.atlassian.com/cloud/jira/software/understanding-jwt/
are not clear in some points, for example it says:

  • In the case of repeated parameters, append the encoded ',' character (i.e., "%2C" ) and subsequent percent-encoded values.

while in fact i shouldn’t encode ‘,’ character because in examples and in service that creates qsh there are no any percent encoded comas.

But that is not the case, my method correctly performs creating qsh for GET requests, but when i try to get qsh from jira on-installed callback i cant get qsh that is described in JWT token whatever i try. It could be easier if i could proceed POST requests on this example service
http://jwt-decoder.herokuapp.com/jwt/decode
but i can’t add POST body there, and when i tried to add POST parameters in query string that service didn’t give me qsh i got in jwt token anyway.

So is there any open source libraries or some more examples on generating qsh? I don’t need exactly .Net libraries, i just want to see the logic at least, or some post request converted for example.

Atlassian has published a NodeJS package for creating JWT, which includes a QSH generator. You can check their logic here: Bitbucket

2 Likes

Thank you, that will help much.

@remie Looked through code and figured out that i don’t have to put POST params from payload in any case. All i have to hash is query string. That guide “understanding jwt” is really misguiding. My method for generating qsh works well now.

1 Like

:+1:
Makes sense, given that it is a querystring hash :joy:
Please note that there is an “Improve this page” button which will allow you to create a pull request with proposed changes to the documentation. If you think you can make it easier to understand for others, make sure to contribute!