Auth0 API Client based on Deno

Auth0 API Client based on Deno

Auth0 Command Line Interface This utility challenges the Resource Owner Password API of Auth0 with a standard username and password login.

Auth0 Command Line Interface

This utility challenges the Resource Owner Password API of Auth0 with a standard username and password login.

⚠️ Development Only

This flow should only be used from highly-trusted applications that cannot do redirects. If you can use redirect-based flows from your app, we recommend using the Authorization Code Flow instead.



This tools is targeted for Deno, see the official installation instructions for details.

Auth0 Regular Web Application

On the Auth0 management site, create an application based on a regular web application profile.

  • Enable Refresh Token Rotation (recommended)
  • Enable Refresh Token in GRANTS
  • Activate the needed Database Connections

Tenant Configuration

Create an .env file or export the following variables with the parameters from the Auth0 tenant.

# The API Audience URL of your tenant

# Properties of the Application

# The tenant domain (

# Which database connection to use

# Your login credentials

Note that environment variables have precedence over entries in .env file.


This utility requires the following permissions at runtime:

  • --allow-env the whole tenant configuration is passed by environment variables
  • --allow-net API calls need network access
  • --allow-read Load existing session files from ~/.auth0cli-<clientId>.json
  • --allow-write Save new session files to ~/.auth0cli-<clientId>.json
deno install -qf --allow-env --allow-net --allow-read --allow-write auth0cli.ts

Install directly from github:

deno install -qf --allow-env --allow-net --allow-read --allow-write


> auth0cli login

Initiates a new session and challenges with the username and password. On success the result will be logged to console and the session JSON will be recorded into ~/.auth0cli-<clientId>.json

> auth0cli machine

Uses the client id and secret for a client grant challenge. This requires the application to be enabled for this flow in the API and usually has lower quotas allowed (1000/month for Auth0). See client grants for details.

> auth0cli refresh

Loads a cached session from ~/.auth0cli-<clientId>.json and initiates a refresh token challenge. On success the new tokens and updated expiration will logged to console and the session file will be updated.

Example output

  "accessToken": "eyJhbGciOiJSU...",
  "refreshToken": "v1.MaqSwVdfr...",
  "scope": "offline_access",
  "expiresIn": 86400,
  "tokenType": "Bearer",
  "expiresAt": "2020-11-09T19:34:46.246Z"

From this output, the accessToken and tokenType can be copied for instance to build an API request with an authorization header:

headers: {
  'Authorization': `${tokenType} ${accessToken}`


Make sure your environment is set and run the following:

deno test -A --unstable --coverage

Download Details:

Author: sdescarries

Source Code:

deno nodejs node javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings