Setting access token cookie in Loopback?

Viewed 4202

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.

2 Answers
Related