首页 > 解决方案 > How to store login information for an api which requires Username - Password for the next session

问题描述

I'm working with an unofficial n26 API (https://github.com/PierrickP/n26/tree/develop). The api requires the email and password to login to the account. I don't want the user to login every single time so I need to store these information somehow. I can't find any way to get a session token or something for later use from the api. (maybe someone of you can find it??)

So my question: How do I store Email/Password for later use in a secure way?

const N26 = require('n26');

// Log into the account
const account = new N26('example@mail.com', 'password');
// Get the last 10 transactions
account.then(account => account.transactions({limit: 10}))
.then(transactions => {
    // Do something with it
});

标签: javascriptnode.jsapisessionauthentication

解决方案


http://www.passportjs.org/查看这个包。

需要考虑的事项:
- 带有刷新令牌的 json Web 令牌
- API 密钥


推荐阅读