Add a hook for the redirect that fires after the log in action
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{
"name": "customers",
"base": "User",
"idInjection": true,
"properties": {
"NAME": {
"type": "string",
"required": false
},
"email":{
"type":"string",
"required":false
},
"username":{
"type":"string",
"required":false
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": []
}
but not working!
First, it looks like your json isn't quite correct Model Name. Should be customer. Plural is customers. Second, make sure that the fields you are overriding are named properly (and the same) . Third, what is in your js file for the model?
One more thing... How did you create the model?
module.exports = function(customer){
}
And then i made the following entry in model-config.js
"customer": {
"dataSource": "mango-database",
"public": true
}
So you have this line in your example:
if (!req.accessToken) return res.sendStatus(401);
link: https://github.com/strongloop/loopback-example-user-management/blob/master/server/boot/routes.js#L45
Ok, looks fine. But how do you push the accessToken
into req
so that the accessToken
can be checked out that way?
In your login
route I only see this. You only return the accessToken
on the client:
res.render('home', {
email: req.body.email,
accessToken: token.id
});
link https://github.com/strongloop/loopback-example-user-management/blob/master/server/boot/routes.js#L36
And what does happen then? How the accessToken
is a property of req
, req.accessToken
?