All pages
Powered by GitBook
1 of 1

JavaScript / TypeScript Hooks

JavaScript / TypeScript Hooks is one of the supported hooks to receive events.

The Hooks DO NOT have access to file, or environment. They only have access to external network.

The stdout and the stderr of the Hooks are both ignored. Your hooks MUST NOT assume anything on the arguments and the stdin of the module.

Configure Authgear to deliver events to your Hooks

  1. In the portal, go to Advanced > Hooks.

  2. Add your Hooks in Blocking Events and Non-Blocking Events, depending on which event you want to listen to.

  3. Click Save.

Examples

Here is an example of a Hook for a blocking event.

An example to mutate a JWT token

Here is an example of a Hook for a non-blocking event.

TypeScript Definition

Alternatively, you can edit your hook and use the Deno CLI to typecheck.