Vote count:
0
I'm trying to do a RESTful interface which is sessionless for a mobile app.
The reason for this question I'm not clear such an app (multiple IDE/platforms) supports the same functionality available in "curl --user", but I know how to produce POST at least for proof of concept.
The passport-http 'basic' example contains the following code:
app.get('/',
// Authenticate using HTTP Basic credentials, with session support disabled.
passport.authenticate('basic', { session: false }),
function(req, res){
res.json({ username: req.user.username, email: req.user.email });
});
explains how to test with this curl example:
curl --user bob:secret http://127.0.0.1:3000/
How can the passport-http 'basic' example code be changed to accept the username/password in a POST, to allow this sort of curl request?
curl -X POST -d username=bob -d password=secret http://127.0.0.1:3000/
asked 1 min ago
passport.js RESTful auth in POST json or ? url extensions
Aucun commentaire:
Enregistrer un commentaire