1
0
-1

Hi,

I have created a process that uses the Json tool to get an API token from my Https call.

I get the token back, and are then using the token in my next call.. but it's seems that my token is no longer valid (e.g. looks like my connection is not persisted, and the new connection fails because another token is expected).

Same calls works with other tools like Postman and even VBA.

Is there a way for joget to persist the connection (e.g token value), throughout the entire process? 

  1. Erik Jarlstrom

    Here is what I see in the log:

    INFO 22 Dec 2019 20:13:52 org.joget.apps.app.lib.JsonTool - POST : https://napslxapp01.infaaws.com:6243/web.isp/login
    INFO 22 Dec 2019 20:13:52 org.joget.apps.app.lib.JsonTool - Custom JSON Payload : {user:"admin",password:"admin",namespace:"Native"}
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - https://napslxapp01.infaaws.com:6243/web.isp/login returned with status : 200
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - {"infaToken":"MDsMndnucJ34ybs6VUlfGbZu8trrhIXcCbSGKKZwERA*","displayName":"The Administrator","logoutURL":"/web.isp/login","namespace":"Native","message":"You have been successfully authenticated.","userID":"admin","username":"The+Administrator"}
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - POST : https://napslxapp01.infaaws.com:6243//internal/subjectRegistry/search?entityName=US_CUST
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - Custom JSON Payload : {"sortField": "", "sortType": "", "searchType": "EJ", "searchlayout":{"FullName": "Erik", "City": "", "ZipCode": ""}}
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - Adding request header Content-Type : application/json
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - Adding request header infaToken : MDsMndnucJ34ybs6VUlfGbZu8trrhIXcCbSGKKZwERA*
    INFO 22 Dec 2019 20:13:53 org.joget.apps.app.lib.JsonTool - https://napslxapp01.infaaws.com:6243//internal/subjectRegistry/search?entityName=US_CUST returned with status : 302

  2. Erik Jarlstrom

    Address is wrong, but same result (e.g. status:302), because it does not keep the connection alive

    should have been this:

    https://napslxapp01.infaaws.com:6243/internal/subjectRegistry/search?entityName=US_CUST


  3. Erik Jarlstrom

    I have created a process with two JSON calls to get a token .. to show that each process step is like a new call:

    Joget response:


    Done with Postman (e.g. call the same API call twice as above):

    2nd call – Note that it will not return token since I just got it

  4. Erik Jarlstrom

    Ups.. image did not work.. here from log file

    INFO 26 Dec 2019 10:06:07 org.joget.sample.JsonCallFormOptionsBinder - POST : https://napslxapp01.infaaws.com:6243/web.isp/login
    INFO 26 Dec 2019 10:06:07 org.joget.sample.JsonCallFormOptionsBinder - Custom JSON Payload : {user:"admin",password:"admin",namespace:"Native"}
    INFO 26 Dec 2019 10:06:07 org.joget.sample.JsonCallFormOptionsBinder - https://napslxapp01.infaaws.com:6243/web.isp/login returned with status : 200
    INFO 26 Dec 2019 10:06:07 org.joget.sample.JsonCallFormOptionsBinder - {"infaToken":"Pa5qmLbJcbak5%2ByKu3l6KF5gWNGMnGbGDVsKNmYoV%2Bo*","displayName":"The Administrator","logoutURL":"/web.isp/login","namespace":"Native","message":"You have been successfully authenticated.","userID":"admin","username":"The+Administrator"}
    INFO 26 Dec 2019 10:06:11 org.joget.sample.JsonCallFormOptionsBinder - POST : https://napslxapp01.infaaws.com:6243/web.isp/login
    INFO 26 Dec 2019 10:06:11 org.joget.sample.JsonCallFormOptionsBinder - Custom JSON Payload : {user:"admin",password:"admin",namespace:"Native"}
    INFO 26 Dec 2019 10:06:11 org.joget.sample.JsonCallFormOptionsBinder - https://napslxapp01.infaaws.com:6243/web.isp/login returned with status : 200
    INFO 26 Dec 2019 10:06:11 org.joget.sample.JsonCallFormOptionsBinder - {"infaToken":"20mzHpzvC02GUSKTyowpng8blans4m3RHRY-Z2q35ko*","displayName":"The Administrator","logoutURL":"/web.isp/login","namespace":"Native","message":"You have been successfully authenticated.","userID":"admin","username":"The+Administrator"}

CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1

    Hi, in the JSON Tool you can configure it to store the value of token in a form or a workflow variable. You can then add that token in the request header using either the Hash Variable#FormDataHashVariable or Hash Variable#WorkflowVariableHashVariable

    1. Erik Jarlstrom

      Anders,

      I am already storing the token I get from the first call (as a workflow variable), and use it for the 2nd call in the process.

      The problem is that the token is expired, since that the 2nd call is a new session.

    CommentAdd your comment...