Having issue with our Importer utility for Zephyr for Jira Cloud.Please click here for the steps to resolve the issue. If you are not able to access Capture Cloud and seeing a message, it means your Capture cloud instance is not migrated as part of our GDPR and Atlassian privacy policy. Please click here for the steps to Migrate your Capture Cloud instance to use Capture.
Support | Zephyr

How to Generate JWT token from Command Line (JAVA)

Created on

Problem : Installed ZAPI CLOUD and wondering how to generate JWT token without using IDE

Solution : There are various ways to generate JWT Token. Java samples are available in our knowledge base. Please follow the below steps to create a JWT token using Java sample from command line without having any IDE like eclipse.

Pre-requisites :

Confirm Java8 is installed and JAVA_PATH set. Check Java version installed on your machine using below command.

G:\ZAPI_CLoud>java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)

Steps : 

Download the jwt-generator.jar and sampleJwtGenerator.java save to the same location say G:\ZAPI_CLoud.

Edit the parameter values for accessKey,secretKey,userName and API in the file sampleJwtGenerator.java matching your requirement.

  1. Open command prompt.
  2. Change directory to the location of your java file downloaded above G:\ZAPI_CLoud
  3. Compile your java file adding the dependency jar jwt-generator.jar to classpath as shown below:

    G:\ZAPI_CLoud>javac -cp ".;jwt-generator.jar" sampleJwtGenerator.java

  4. Now, run the class file generated using the below command

    G:\ZAPI_CLoud>java sampleJwtGenerator

  5. You will get the Final API and JWT token as output

    6. Use the Final API and JWT Token created above to make API requests.


Was this article helpful?
0 out of 5 found this helpful
Have more questions? Submit a request
Powered by Zendesk