Skip to content
This repository was archived by the owner on Mar 21, 2021. It is now read-only.

Commit bcd122c

Browse files
committed
Add documentation for two factor authentication
* added info in README on 2fa * fixed typo in README * added example for 2fa
1 parent 7cfe4b3 commit bcd122c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You can also provide your user and pass via environment variables:
3232

3333
```javascript
3434
// run as:
35-
// DEGIRO_USER=johndow DEGIRO_PASS=1234 node app.js
35+
// DEGIRO_USER=johndoe DEGIRO_PASS=1234 node app.js
3636

3737
const DeGiro = require('degiro');
3838
// now you don't need to provide your credentials
@@ -48,6 +48,15 @@ degiro.login().then(session => console.log(session));
4848
// prints session info (session id and account number)
4949
```
5050

51+
Two factor authentication is also supported. Pass the 2fa token through javascript or as an environment variable.
52+
53+
```javascript
54+
const DeGiro = require('degiro');
55+
// alternatively run as:
56+
// DEGIRO_USER=johndoe DEGIRO_PASS=1234 DEGIRO_ONE_TIME_PASS=123456 node app.js
57+
const degiro = DeGiro.create({username: 'johndoe', password: '1234', oneTimePassword: '123456'});
58+
```
59+
5160
You can reuse your sessions if you provide the id and account number via environment variables (`DEGIRO_SID`
5261
and `DEGIRO_ACCOUNT`), direct assignment or constructor parameters.
5362

examples/two-factor-login.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const DeGiro = require('..');
2+
3+
// Set your username, password and oneTimePassword (google
4+
// authenticator token) below or run from terminal as:
5+
// DEGIRO_USER=username DEGIRO_PASS=password DEGIRO_ONE_TIME_PASS=token node examples/two-factor-login.js
6+
7+
const degiro = DeGiro.create({
8+
// username: 'john',
9+
// password: 'password',
10+
// oneTimePassword: '123456'
11+
});
12+
13+
degiro.login()
14+
.then(console.log)
15+
.catch(console.error);
16+

0 commit comments

Comments
 (0)