Forum Discussion

deepakbhatt's avatar
deepakbhatt
New Contributor
3 years ago

Getting the error "401 - Unauthorized&quot;</code> error while loading this page."

Getting authorization error even though the JWT token is provided, How can we make sure jwt token return is correct or not ?

$ cat zephyr.sh
accessKey="N2NhNDA5MWQxNGU4IDYxMTM1YzA2YWU3MmIyMDA2ZmJmZWM1ZiBVU0VSX0RFRkFVTFRfTkFNRQ"
secretKey="pGEYmuPbe5Z9Y8km0eRfgCLhJeNV3z_tAcs"
accountId="61135c06fbfec5f"
echo "Generating a JSOM Web Token ... \n"
#zephyrBaseUrl="https://prod-play.zephyr4jiracloud.com/connect"
zephyrBaseUrl="https://<cmp>.atlassian.net/"


curl -o headers -s -d '{ "accessKey": "'"$accessKey"'" , "secretKey": "'"$secretKey"'" ,"accountId": "'"$accountId"'","zephyrBaseUrl": "'"$zephyrBaseUrl"'","expirationTime":360000}' -H "Content-Type: application/json" -XPOST https://prod-vortexapi.zephyr4jiracloud.com/api/v1/jwt/generate


jwt="$(cat headers | head -n 1)"
#jwt="$(cat headers)"
echo "The generated token: \n"
echo $jwt
#curl --include --header "Content-Type: text/plain" --header "Authorization: $jwt" --header "zapiAccessKey: $accessKey" 'https://<comp>.atlassian.net/rest/api/1.0/cycles/search?versionId=&expand=&projectId=<project id given here>'

#curl --include --header "Content-Type: text/plain" --header "Authorization: $jwt" --header "zapiAccessKey: $accessKey" 'https://ime-ddn.atlassian.net/rest/api/latest/project/<project_key>'