I have implemented a simple authentication REST API server that I want to use with shinyproxy webservice authentication option. Here is the application.yml excerpt:
proxy:
...
authentication: webservice
# User authentication
webservice:
authentication-url: https://pretendhost.com/shinyproxy/login
authentication-request-body: "{username: %s, password: %s}"
...
When I use that URL and body in postman to test my server, it works fine, so I believe my server is working. But when I login to shinyproxy, my authenticating server throws a JSON syntax error (I am using simple:json-routes in meteor):
2019-08-22T21:20:22.432382244Z SyntaxError: Unexpected token k in JSON at position 13
2019-08-22T21:20:22.432418232Z at JSON.parse (<anonymous>)
2019-08-22T21:20:22.432425192Z at parse (/built_app/programs/server/npm/node_modules/meteor/simple_json-routes/node_modules/connect/node_modules/body-parser/lib/types/json.js:88:17)
2019-08-22T21:20:22.432431108Z at /built_app/programs/server/npm/node_modules/meteor/simple_json-routes/node_modules/connect/node_modules/body-parser/lib/read.js:108:18
2019-08-22T21:20:22.432435520Z at invokeCallback (/built_app/programs/server/npm/node_modules/meteor/simple_json-routes/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:262:16)
2019-08-22T21:20:22.432439503Z at done (/built_app/programs/server/npm/node_modules/meteor/simple_json-routes/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:251:7)
2019-08-22T21:20:22.432443581Z at IncomingMessage.onEnd (/built_app/programs/server/npm/node_modules/meteor/simple_json-routes/node_modules/connect/node_modules/body-parser/node_modules/raw-body/index.js:308:7)
2019-08-22T21:20:22.432447513Z at emitNone (events.js:111:20)
2019-08-22T21:20:22.432450907Z at IncomingMessage.emit (events.js:208:7)
2019-08-22T21:20:22.432454694Z at endReadableNT (_stream_readable.js:1064:12)
2019-08-22T21:20:22.432458428Z at _combinedTickCallback (internal/process/next_tick.js:139:11)
2019-08-22T21:20:22.432461755Z at process._tickDomainCallback (internal/process/next_tick.js:219:9)
The “Unexpected token k …” is referring to the first character in the username being passed to the server by shinyproxy.
This is the body of my test request in postman:
{
"username": "kooks@hah.com",
"password": "11234"
}
Is that consistent with the request body that is coming from shinyproxy? If not, how does it differ?