1.0.3 • Published 4 years ago
@node-cli-toolkit/generate-oauth-token-cli v1.0.3
@node-cli-toolkit/generate-oauth-token-cli
Generates an oauth token using the CLI and saves it to a file.
Installation
yarn add @node-cli-toolkit/generate-oauth-token-cli
In your package.json
add the following scripts:
{
"scripts": {
"create-token-file": "generate-oauth-token-cli --saveTokenToFile --tokenIdentifier YOUR_TOKEN_ID --oauthStrategy passport-whatever-strategy --oauthStrategyOptions.someOption someValue --appKey=$YOUR_APP_KEY --appSecret=$YOUR_APP_SECRET"
}
}
Usage
After you've added the command to your scripts you can run it using:
yarn run create-token-file
The command accepts the following flags:
saveTokenToFile
: Saves the token you generate to a file which can be retrieved using@node-cli-toolkit/save-token/getToken
tokenIdentifier
: A unique identifier for your token. Checksave-token
documentation for instructions on how to name your tokenoauthStrategy
: The oauth passport strategy we are using to create the token (ex:passport-dropbox-oauth2
)oauthStrategyOptions.whateverOption
: Pass in any extra options for theoauthStrategy
using dot notation. (ex:--oauthStrategyOptions.apiVersion 2
)appKey
: The app key for the oauth application you're trying to use. Recommended that you store this as an environmental variable in your.zshrc
and reference it using$WHATEVER_APP_KEY
appSecret
: The app secret for the oauth application you're trying to use. Recommended that you store this as an environmental variable in your.zshrc
and reference it using$WHATEVER_APP_SECRET
Other than that it will pass through any flags you pass as options to oauth-cli
Tests and Todos
Everything in this package is tested thoroughly. You can also see planned features as part of the tests' todos. See tests directory.