auth0/wt-cli

Name: wt-cli

Owner: Auth0

Description: Webtask CLI - all you need is code

Created: 2015-06-05 21:27:22.0

Updated: 2018-05-24 14:29:25.0

Pushed: 2018-05-24 05:22:32.0

Homepage: https://webtask.io

Size: 859

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Webtask CLI: all you need is code

Command line tool for using webtasks to create microservices in seconds.

Setup
m i -g wt-cli
 init
Usage
Create a webtask

Write webtask code to the hello-world.js file:

le.exports = function (cb) {
(null, 'Hello webtasks!');

ash
reate hello-world.js

and call it…

 https://webtask.it.auth0.com/api/run/{yours}/hello-world
Create a webtask (from a public URL)
reate https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/html-response.js \
      --name html-response-url
Create a webtask with a secret
reate https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js \
      --name mongo \
      --secret MONGO_URL=mongodb://webtask:supersecret@ds047592.mongolab.com:47592/webtask-examples

This is a real mongodb URL (powered by mongolab), no guarrantee that it will work :)

Create a webtask that integrates with express.js
reate https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/express.js \
      --name express \
      --no-parse --no-merge
Log streaming
ogs
Cron a webtask (long running)
ron schedule -n mongocron \
             -s MONGO_URL=mongodb://webtask:supersecret@ds047592.mongolab.com: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
ron history mongogron
Get all scheduled webtasks
ron ls

Auth0 CLI: extend Auth0 with custom code (BETA)

Auth0 hooks enable you to extend 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.

Setup

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 wt.

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.

Overview

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:

client-credentials-exchange password-exchange pre-user-registration post-user-registration

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.

Synopsis

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 wt-cli setup.

affold sample code of an Auth0 hook:
0 scaffold -t pre-user-registration > file.js

eate a new, disabled Auth0 hook:
0 create -t pre-user-registration --name my-extension-1 -p tj-default file.js

it code of the Auth0 hook:
0 edit my-extension-1

able the newly created extensibility point (all other hooks associated
th the same extensibility point will be disabled):
0 enable my-extension-1 -p tj-default

st hooks for a specific extensibility point:
0 ls -t pre-user-registration -p tj-default

st all Auth0 hooks on your account:
0 ls -p tj-default

cess streaming, real-time logs of all of your hooks:
0 logs -p tj-default

sable a hook:
0 disable my-extension-1 -p tj-default

lete a hook:
0 rm my-extension-1 -p tj-default

Closing remarks

Working behind a proxy

wt-cli supports operating behind a proxy as of v6.1.0. The cli relies on the HTTP_PROXY (or 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 http requests | Proxy Agent for https requests | Example |:———-:|:——————————-:|:——————————–:|:——–: | http | http-proxy-agent | https-proxy-agent | http://proxy-server-over-tcp.com:3128 | https | http-proxy-agent | https-proxy-agent | https://proxy-server-over-tls.com:3129 | socks(v5)| socks-proxy-agent | socks-proxy-agent | socks://username:password@some-socks-proxy.com:9050 (username & password are optional) | socks5 | socks-proxy-agent | socks-proxy-agent | socks5://username:password@some-socks-proxy.com:9050 (username & password are optional) | socks4 | socks-proxy-agent | socks-proxy-agent | socks4://some-socks-proxy.com:9050 | pac | pac-proxy-agent | pac-proxy-agent | pac+http://www.example.com/proxy.pac

Issue Reporting

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.

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.