Webtask CLI: all you need is code
Command line tool for using webtasks to create microservices in seconds.
$ npm i -g wt-cli$ wt init
Create a webtask
Write webtask code to the hello-world.js file:
wt create hello-world.js
and call it...
Create a webtask (from a public URL)
wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/html-response.js \--name html-response-url
Create a webtask with a secret
wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js \--name mongo \--secret MONGO_URL=mongodb://webtask:email@example.com:47592/webtask-examples
This is a real mongodb URL (powered by mongolab), no guarantee that it will work :)
Create a webtask that integrates with express.js
wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/express.js \--name express \--dependency express \--dependency body-parser
Cron a webtask (long running)
wt cron schedule -n mongocron \-s MONGO_URL=mongodb://webtask:firstname.lastname@example.org:47592/webtask-examples \"*/10 * * * *" \https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js
This cron will insert a document in a mongo collection every 10 minutes
Get cron history
wt cron history mongogron
Get all scheduled webtasks
wt cron ls
Auth0 CLI: extend Auth0 with custom code (BETA)
Auth0 hooks enable you to extend the Auth0 platform with custom code. Auth0 CLI allows you to manage Auth0 hooks for your Auth0 account.
Auth0 hooks are webtasks associated with specific extensibility points of the Auth0 platform that are invoked by Auth0 runtime to execute your custom logic.
Follow the instructions from the Account > Webtasks panel on the Auth0 management dashboard to install and configure
wt-cli. The package now includes
auth0 binary in addition to
NOTE While Auth0 CLI is in BETA, the
wt-cli tool must be installed from a branch of this repository instead of the public npm registry. Use
npm i -g auth0/wt-cli#auth0 to install the tool. The rest of the instructions on the Auth0 management portal applies without changes.
Auth0 CLI allows you to create, list, enable/disable, edit, and remove Auth0 hooks associated with specific extensibility points within the Auth0 platform, as well as receive real-time logging information generated by custom code.
The list of supported extensibility points will be growing over time. Currently, the following extensibility points are supported:
For each of the extensibility points, there can be several Auth0 hooks created. A hook can be enabled or disabled, but only up to one hook per extensibility point can be enabled at a time. Disabled hooks are useful for staging new functionality.
The script below assumes you are creating an Auth0 hook for the
pre-user-registration extensibility point using profile name
tj-default. You can use any of the extensibility points listed above and the actual profile name has been provided to you during
# Scaffold sample code of an Auth0 hook:auth0 scaffold -t pre-user-registration > file.js# Create a new, disabled Auth0 hook:auth0 create -t pre-user-registration --name my-extension-1 -p tj-default file.js# Edit code of the Auth0 hook:auth0 edit my-extension-1# Enable the newly created extensibility point (all other hooks associated# with the same extensibility point will be disabled):auth0 enable my-extension-1 -p tj-default# List hooks for a specific extensibility point:auth0 ls -t pre-user-registration -p tj-default# List all Auth0 hooks on your account:auth0 ls -p tj-default# Access streaming, real-time logs of all of your hooks:auth0 logs -p tj-default# Disable a hook:auth0 disable my-extension-1 -p tj-default# Delete a hook:auth0 rm my-extension-1 -p tj-default
Working behind a proxy
wt-cli supports operating behind a proxy as of
v6.1.0. The cli relies on the
http_proxy) environment variable to determine if proxy support needs to be enabled. The
HTTP_PROXY environment variable must be set to a uri according to the following table:
|Protocol||Proxy Agent for
||Proxy Agent for
- See http-proxy-agent for the source of this table.
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.