create-zeit-token
v0.1.1
Published
Node module to programmatically obtain ZEIT tokens
Downloads
3
Readme
create-zeit-token
This is a Node module to obtain a new ZEIT token for a supplied account. The implementation is based on puppeteer
and EventEmitter
Usage
npm install create-zeit-token
Then use it like this example:
const T = new CreateZeitToken("[email protected]");
T.getSecurityCode().then(async code => {
console.log(code); // Security code is usually in the form of Adjective-Animal
});
T.on("token", token => {
console.log(`token is ${token}`);
});
API
class: CreateZeitToken
const z = new CreateZeitToken("[email protected]");
z.getSecurityCode().then(async code => {
console.log(code); // Security code is usually in the form of Adjective-Animal
});
z.on("token", token => {
console.log(`token is ${token}`);
});
z.getSecurityCode(opts)
opts
<Object> a puppeteer options object- returns <Promise<String>>
z.resetSession()
- returns <Promise>
Creates a new browser session which will create new Security Code
event: 'token'
- <String> Bearer Token
Emitted when Puppeteer first detects a valid Authorization
header.
Roadmap
- [ ] Allows named token instead of
Chrome (Browser)
coming from Puppeteer - [ ] Use direct API if possible?
- [ ] API documentation
License
MIT.