-
Notifications
You must be signed in to change notification settings - Fork 6
/
demo.js
22 lines (19 loc) · 623 Bytes
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var login = require('..');
var options = {
loginFormId: 'loginform',
tokenFieldName: 'csrfmiddlewaretoken',
loginPath: '/key/accounts/login/',
username: process.env.username,
password: process.env.password,
host: process.env.host
};
// to use, change the above options
// and pass the rest via command line, for example
// DEBUG=csrf username=user password=pass host=http://localhost:1337 node demo.js
console.log('trying to login', options.username, 'to', options.host);
login(options)
.then(function (result) {
console.log('logged in, jar is');
console.log(result.jar._jar.store)
})
.done();