• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.


No announcement yet.

Authenticate from API platform

  • Filter
  • Time
  • Show
Clear All
new posts

  • Authenticate from API platform

    We are working on setting up a more robust dedicated API platform for accessing our data. As part of this, it would be nice if users hitting the APIs from a Valence app could simply use the Valence session id as a form of authentication. To do so, I figured we could use valence-connect to connect to the Valence instance and then use it to get session and/or user information to verify that its a valid token like a standard bearer authentication protocol.

    I tried this scenario in a few different instances to test it. I setup node on my local pc and used the acme test framework to run the test and it works fine. I setup the same test on our actual IBMi test server and it works fine there too. However, when I setup the same scenario to run from an API endpoint (which runs off of node), it fails with this error:

    TypeError: this.sidStorage.getItem is not a function
    at ValenceConnect.getSessionStorage (/ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:5973)
    at /ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:5886
    at new Promise (<anonymous>)
    at ValenceConnect.getSidStorage (/ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:5808)
    at /ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:5454
    at new Promise (<anonymous>)
    at ValenceConnect.getInfo (/ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:4984)
    at /ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:3446
    at new Promise (<anonymous>)
    at ValenceConnect.getUserInformation (/ProfoundJS/node_modules/valence-connect/dst/index.min.js:1:3411)

    I cannot figure out why this particular version is failing in this manner. The valenceConnect.init call succeeds but the subsequent valenceConnect.getUserInformation call fails with this error. All test instances mentioned above are doing the exact same two calls.