Summary
This article provides steps for getting a JWT token to authorize scriptRunner for FlexNet Code Insight 6.8.Question
How do I get a JWT token to authorize scriptRunner for FlexNet Code Insight 6.8?Answer
-
Launch the web browser as a user who has Scripting Administrator privileges.
-
After logging into the application, click on My Settings on the top right corner of the screen. Scroll to the bottom where you can add a Token.
-
Proceed to add a token with a name to identify it, the desired expiration date, and copy the token as you will need it to run ScriptRunner.
-
Navigate to the scriptRunner/bin directory to launch scriptRunner. You will need to The -c flag connects the core server, which needs to use the http(s) port used by the application, the same core server url specified in core.properties. Use the -u flag with the authorized user after you have copied the jwt Token from the Web UI.
./scriptRunner.sh -u username_of_scripting_administrator -c http(s)://core.server.url:8888/palamida/
- This will prompt you to enter the jwt Token, paste it in for the one time authorization. If the authorization is successful, the groovy commandline console will be launched. Exit the console with the command exit.
How to use JWT token while calling REST Apis
Here are couple of examples to use JWT token in a java REST client or javascript client.
RestClient.java
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation.Builder;
public class RestClient {
public static void connect() {
String jwtToken = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTQ1MDM4Nzc5MH0.eIAZFqX9Mm5qlsHTjiztWBgT62RyDWPlBzp0phdgJaY";
String target = "https://dev-linux-1.eng.palamida.com:8888/palamida/api/component/lookup componentNames=zlib&versionNames=1.2.8&forgeIds=175";
Builder builder = ClientBuilder.newClient().target(target).request();
builder.header("JWT_TOKEN", jwtToken);
String result = builder.get().readEntity(String.class);
System.out.println(result);
}
}
rest-client.js
<\!DOCTYPE html>
<html>
<head>
<title>JWT Token Test</title>
<script src="https://code.jquery.com/jquery-2.2.0.min.js" ></script>
<script src="json-minified.js" ></script>
<script>
$(document).ready(function() {
$("#zlib").click(function() {
$.ajax({
dataType: "json",
type: "GET",
beforeSend : function( xhr ) {
xhr.setRequestHeader
("JWT_TOKEN", "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTQ1MDM4Nzc5MH0.eIAZFqX9Mm5qlsHTjiztWBgT62RyDWPlBzp0phdgJaY");
},
url: "https://dev-linux-1.eng.palamida.com:8888/palamida/api/component/lookup?componentNames=zlib&versionNames=1.2.8&forgeIds=175",
success: function(data) {
var obj = JSON.stringify(data);
$('.c-data').append(obj);
}
})
})
});
</script>
</head>
<body>
<input type="button" id="zlib" value="Click to find component zlib data" />
<p class="c-data"></p>
</body>
</html>Related Articles
FlexNet Code Insight ScriptRunner returns "Current user admin doesn't have script admin role" error 3Number of Views FlexNet Code Insight Scripting - Getting Started 3Number of Views How do I enable SSL for FlexNet Code Insight? 30Number of Views Cannot get property 'config/core/emails/new_comment_body.html' on null object in FlexNet Code Insight. 12Number of Views FlexNet Code Insight Triage and Preliminary Troubleshooting 3Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago