I am new in creating jira plugin. I am trying to create a jwt token to read (and write in future) using rest api. When I connect with jira cloud with the token, I receive 401 (Unauthorized) status code. To check my tokens validity I paste my JWT token at http://s3.amazonaws.com/www.jsonwebtoken.io/index.html, it parse the the header and claim part without any issue, but it cannot validate the signature part. I wrote the token generator in PHP using FirebaseJWT as follows
use \Firebase\JWT\JWT; $qsh = hash('sha256', "GET&/rest/api/2/application-properties&"); $token = array ( 'iss' => 'my.jiraplugin.example.com', 'iat' => 1530907762, 'exp' => 1530911586, 'qsh' => $qsh, ); $jwt = JWT::encode($token, "7pTMUDgs7UGGhLAp0lnyfzs+tz8LNxcQUQW3+U7wI7xXZnL7HgZcIyLkiF1bF1xYVkcO6zFHagUjQZ+mWXmb3Q"); echo $jwt;
The code is straight forward, and I am not sure, where exactly I am making mistake. I am really stuck on this, and I am in desperate need for help. Please let me know how can I fix it.