https://github.com/mathdroid/create-zeit-token
Create and obtain ZEIT tokens programmatically
https://github.com/mathdroid/create-zeit-token
Last synced: 4 months ago
JSON representation
Create and obtain ZEIT tokens programmatically
- Host: GitHub
- URL: https://github.com/mathdroid/create-zeit-token
- Owner: mathdroid
- Created: 2018-03-05T04:23:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-05T05:04:46.000Z (almost 8 years ago)
- Last Synced: 2025-08-09T03:58:50.390Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.42 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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
```bash
npm install create-zeit-token
```
Then use it like this example:
```js
const T = new CreateZeitToken("example@gmail.com");
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
```js
const z = new CreateZeitToken("example@gmail.com");
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` \ a puppeteer options object
* returns \>
### z.resetSession()
* returns \
Creates a new browser session which will create new Security Code
### event: 'token'
* \ 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.