Can't log in
-
I just added the authentication bits to my jsreport.config.json file as found here: https://jsreport.net/learn/authentication
Specifically, I'm using this bit:
"authentication" : { "cookieSession": { "secret": "dasd321as56d1sd5s61vdv32", "cookie": { "secure": true } }, "admin": { "username" : "admin", "password": "password" } }
When I log in using the credentials stated there, I'm presented with the login screen again and my log gives me this:
Options { where: { username: undefined, active: 1 } } Executing (default): SELECT [id], [username], [displayName], [company], [department], [mail], [mobile], [directReports], [active], [createdAt], [updatedAt] FROM [users] AS [user] WHERE [user].[username] = NULL AND [user].[ active] = 1 ORDER BY [user].[id] OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY; 2019-07-08T20:35:59.960Z - info: Logging in user admin
Did I miss something?
-
hi! i guess you are not enabling https in your server.
the docs says that your server should be able to process https requests when using the
secure: true
for example you can set { "cookie": { "secure": true } } to indicate that the auth cookie will only be send over HTTPS, which is a good security practice but it requires that your server works under https first.
you can remove the
secure: true
option until you enable the https
-
Weird. My server app is HTTPS only and works great. Perhaps there's something I don't understand when it comes to placing jsreport inside my main server app. Are there other jsreport settings I need to add to my config file? Even calling the reports from Postman, I'm using HTTPS. It's just when I add the above that it doesn't let me in.
I do have the certificates defined in the config file. I'm using absolute paths as I couldn't figure out what to do to properly use relative paths. I'll paste my whole file below. (Note I removed the authentication changes so I could get it to work again):
{ "extensions": { "authentication": { "enabled": false }, "studio": { "enabled": true }, "scripts": { "allowedModules": "*", "timeout": 140000, "strategy": "http-server" }, "sample-template": { "createSamples": true }, "child-templates": { "parallelLimit": 5 } }, "certificate": { "key": "C:\\Users\\constar1\\Documents\\SutterNow\\Express Projects\\AdminServer\\src\\tls\\pharmacyinformatics.local.key.pem", "cert": "C:\\Users\\constar1\\Documents\\SutterNow\\Express Projects\\AdminServer\\src\\tls\\pharmacyinformatics.local.crt.pem" }, "store": { "provider": "fs" }, "blobStorage": { "provider": "fs" }, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "info", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "allowLocalFilesAccess": true, "templatingEngines": { "timeout": 180000, "strategy": "http-server", "templateCache": { "enabled": true } }, "chrome": { "timeout": 180000 }, "appPath": "/reporting" }
-
hmm ok, did you checked the browser console when the login redirect happened? maybe there is some hint there about the error.
also did you tried the authentication without the
"cookie": { "secure": true }
part? it will be good if you try without that option and see if the authentication works without that.
-
Still didn't work with:
"authentication": { "cookieSession": { "secret": "dasd321as56d1sd5s61vdv32" }, "admin": { "username" : "admin", "password": "password" } },
-
And this didn't either:
"authentication": { "cookieSession": { "secret": "dasd321as56d1sd5s61vdv32", "cookie": { "secure": false } }, "admin": { "username" : "admin", "password": "password" } },