@auth0/actions

中文文档
0.36.0发布于 2026/10/31Apache-2.0TypeScriptCommonJS零依赖构建来源已验证近 30 天下载 21.5万

Official Auth0 Actions TypeScript definitions, which will help you code and test your project's Actions on external editors and IDEs.

原始使用文档
文档目录4 节
  1. 🚀 Getting Started
  2. 💬 Feedback and Contributing
  3. 📄 License
  4. What is Auth0?

Actions for Auth0

License NPM Downloads

🚀 Getting Started • 💬 Feedback

Official Auth0 Actions TypeScript definitions, which will help you code and test your project’s Actions on external editors and IDEs.

🚀 Getting Started

Prerequisites:

Installation:

Install the package using npm:

npm install --save-dev @auth0/actions

Or using yarn:

yarn add --dev @auth0/actions

Or using pnpm:

pnpm add --save-dev @auth0/actions

Usage:

Import the TypeScript definitions into your Auth0 Actions using one of the following approaches:

JSDoc @import:

Use this approach when you want to enable IntelliSense without changing your existing JavaScript code structure:

/** @import {Event, PostLoginAPI} from "@auth0/actions/post-login/v3" */

/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
  const user = event.user;

  // Your Action logic here
  if (user.email?.endsWith('@example.com')) {
    api.user.setAppMetadata('department', 'internal');
  }
}

JSDoc @param:

Use this approach for type safety in JavaScript files using import statements in JSDoc comments:


/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {import('@auth0/actions/post-login/v3').Event} event - Details about the user and the context in which they are logging in.
* @param {import('@auth0/actions/post-login/v3').PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
  const user = event.user;

  // Your Action logic here
  if (user.email?.endsWith('@example.com')) {
    api.user.setAppMetadata('department', 'internal');
  }
}

TypeScript import:

Use this approach when developing with TypeScript for full type checking and modern syntax:

import type { Event, PostLoginAPI } from '@auth0/actions/post-login/v3';

/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event: Event, api: PostLoginAPI) => {
  const user = event.user;

  // Your Action logic here
  if (user.email?.endsWith('@example.com')) {
    api.user.setAppMetadata('department', 'internal');
  }
};

⚠️ Important: When using TypeScript, you must compile your code to JavaScript before deploying to Auth0. The Auth0 Actions runtime only executes JavaScript. Use the TypeScript compiler (tsc) to transpile your .ts files to .js files, before it can be deployed. You must also include JSDoc comments to enable Intellisense in the Dashboard.

💬 Feedback and Contributing

This repository contains automatically generated TypeScript types and utilities for Auth0 Actions development. The types in this package are generated from Auth0's internal systems and are published to help developers build Actions. This repository does not accept external contributions. The contents of this package are automatically generated and maintained by Auth0's internal systems. For help using this package, reporting issues, or providing feedback:

📄 License

Copyright 2026 Okta, Inc.

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

What is Auth0?

Auth0 Logo

Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?

版本与发布记录

@auth0/actions 共发布 31 个版本,首次发布于 2025/10/21;过去 12 个月发布了 27 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.36.0latest2026/10/318 天前
0.35.02026/10/0930 天前
0.34.02026/09/191 个月前
0.33.02026/09/171 个月前
0.32.02026/08/282 个月前
0.31.02026/08/182 个月前

关于 @auth0/actions 的常见问题

@auth0/actions 是什么?

Official Auth0 Actions TypeScript definitions, which will help you code and test your project's Actions on external editors and IDEs.

如何安装 @auth0/actions?

在项目目录运行 npm install @auth0/actions,或使用 pnpm add / yarn add / bun add。

@auth0/actions 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@auth0/actions 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@auth0/actions 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@auth0/actions 可以商用吗?

@auth0/actions 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@auth0/actions 的下载量有多少?

根据 npm 官方下载统计,@auth0/actions 在 2026/10/07 – 2026/11/05 这 30 天内被下载 214,684 次,日均约 7,156 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@auth0/actions 还在维护吗?

最新版本 0.36.0 发布于 2026/10/31(8 天前);至今共发布 31 个版本,其中过去 12 个月发布了 27 个;首次发布于 2025/10/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。