I want to use cookies to keep a user logged in.
On this page here they say
To use cookies for authentication, add the following to server.js (before boot):
app.use(loopback.token({ model: app.models.accessToken }));
Seemed simple enough. I figured the cookies were set by Loopback automatically during the login process but it's still not working, I check my cookies in Chrome dev tools and none are set.
Am I missing something? Otherwise, what's the best way to hook into the login method to have set the cookie/header?
I found docs on the loopback.token()
method here, which says exactly where it checks for the token.
I got it to work. The cookie wasn't being signed.
I'm pretty much new to Express and lower-level stuff like this. I remembered reading that the cookie had to be signed but it slipped my mind that I had to pass "signed: true".
My issue on Github if that helps anyone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With