How to deploy AdminUI Rest API basic-js SDK sample?

Document ID : KB000107598
Last Modified Date : 23/07/2018
Show Technical Document Details
We are trying to use the AdminUI Rest API services but we are getting a HTTP 401 error in the browser. We have tried the basic-js and browser samples and both give the same errors. The admin account works fine when we access AdminUI, and the following error is shown in smrestservices.log:

[2018-06-25 10:15:30][ERROR][][SMRESTAPI_004-Unable to decrypt the JWT token.] AGENTAPI_FAILURE at Source) ~[smrpc-12.70.jar:?] at Source) ~[smrpc-12.70.jar:?] at Source) ~[smrpc-12.70.jar:?] at Source) ~[smrpc-12.70.jar:?] at Source) ~[smadminapi-12.70.jar:?] at (Unknown Source) ~[smrestapi-12.70.jar:?] at (Unknown Source) ~[smrestapi-12.70.jar:?] at Source) ~[smrestapi-12.70.jar:?] at ~[classes:?] at ~[classes:?] at [classes:?] at io.undertow.servlet.core.ManagedFilter.doFilter( [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter( [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at io.undertow.servlet.handlers.FilterHandler.handleRequest( [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest( [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at [wildfly-undertow-8.2.0.Final.jar!/:8.2.0.Final] at io.undertow.server.handlers.PredicateHandler.handleRequest( [undertow-core-1.1.0.Final.jar!/:1.1.0.Final] at [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final] at io.undertow.server.handlers.PredicateHandler.handleRequest( [undertow-core-1.1.0.Final.jar!/:1.1.0.Final] at [undertow-core-

How can we solve it?
AdminUI R12.8 on RHEL7
SDK R12.8 on RHEL7
This basic-js sample is designed to be ran in the AdminUI sso-restapi-services.war, similarly to the browser sample application, therefore it does need to be copied into the sso-restapi-services.war folder and accessed through AdminUI, and not executed in the browser or in another web server. The instructions available in SDK readme file for browser sample application are applicable for the basic-js application as well.

The steps to deploy this sample are: 
1. Copy the content of the directory into the existing sso-restapi-services.war directory in the same container where the AdminUI is running. 
2. Restart AdminUI. 
3. Open a web browser and navigate to https://[WAMUI-HOSTNAME]:8443/ca/api/sso/services/policy/sample.htm. 
4. Set the URL, and the authentication service URL to get the token with the credentials.  
5. Once authenticated, the URL results will be displayed below. 

Remember that the token will last for 15 minutes, and after that time it will expire. Then, it is application logic to regenerate token once it expires.