TypeScript
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.hooks.update("id", {});
}
main();
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.hooks.update("id", {});
}
main();
package example
import (
context "context"
management "github.com/auth0/go-auth0/v3/management"
client "github.com/auth0/go-auth0/v3/management/client"
option "github.com/auth0/go-auth0/v3/management/option"
)
func do() {
mgmt, err := client.New(
"{YOUR_DOMAIN}",
option.WithToken(
"<token>",
),
)
if err != nil {
return
}
request := &management.UpdateHookRequestContent{}
mgmt.Hooks.Update(
context.TODO(),
"id",
request,
)
}
# Ensure you're logged in: auth0 login
auth0 api patch "hooks/id" --data '{}'using Auth0.ManagementApi;
using System.Threading.Tasks;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await client.Hooks.UpdateAsync(
id: "id",
request: new UpdateHookRequestContent()
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.types.UpdateHookRequestContent;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.hooks().update(
"id",
UpdateHookRequestContent
.builder()
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Hooks\Requests\UpdateHookRequestContent;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->hooks->update(
'id',
new UpdateHookRequestContent([]),
);
from auth0.management import ManagementClient
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.hooks.update(
id="id",
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.hooks.update(id: "id")
curl --request PATCH \
--url https://{tenantDomain}/api/v2/hooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
"enabled": false,
"dependencies": {}
}
'{
"triggerId": "<string>",
"id": "00001",
"name": "hook",
"enabled": true,
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
"dependencies": {}
}Update a hook
Update an existing hook.
PATCH
https://{tenantDomain}/api/v2
/
hooks
/
{id}
TypeScript
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.hooks.update("id", {});
}
main();
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
domain: "{YOUR_DOMAIN}",
token: "<token>",
});
await client.hooks.update("id", {});
}
main();
package example
import (
context "context"
management "github.com/auth0/go-auth0/v3/management"
client "github.com/auth0/go-auth0/v3/management/client"
option "github.com/auth0/go-auth0/v3/management/option"
)
func do() {
mgmt, err := client.New(
"{YOUR_DOMAIN}",
option.WithToken(
"<token>",
),
)
if err != nil {
return
}
request := &management.UpdateHookRequestContent{}
mgmt.Hooks.Update(
context.TODO(),
"id",
request,
)
}
# Ensure you're logged in: auth0 login
auth0 api patch "hooks/id" --data '{}'using Auth0.ManagementApi;
using System.Threading.Tasks;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await client.Hooks.UpdateAsync(
id: "id",
request: new UpdateHookRequestContent()
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.types.UpdateHookRequestContent;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.hooks().update(
"id",
UpdateHookRequestContent
.builder()
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Hooks\Requests\UpdateHookRequestContent;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->hooks->update(
'id',
new UpdateHookRequestContent([]),
);
from auth0.management import ManagementClient
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.hooks.update(
id="id",
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.hooks.update(id: "id")
curl --request PATCH \
--url https://{tenantDomain}/api/v2/hooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my-hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
"enabled": false,
"dependencies": {}
}
'{
"triggerId": "<string>",
"id": "00001",
"name": "hook",
"enabled": true,
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
"dependencies": {}
}Authorizations
bearerAuthoAuth2ClientCredentials
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the hook to update.
Body
application/jsonapplication/x-www-form-urlencoded
Name of this hook.
Pattern:
^[a-zA-Z0-9]([ \-a-zA-Z0-9]*[a-zA-Z0-9])?$script
string
default:module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };
Code to be executed when this hook runs.
Minimum string length:
1Whether this hook will be executed (true) or ignored (false).
Dependencies of this hook used by webtask server.
Show child attributes
Show child attributes
Response
Hook successfully created.
Trigger ID
ID of this hook.
Name of this hook.
Whether this hook will be executed (true) or ignored (false).
script
string
default:module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };
Code to be executed when this hook runs.
Dependencies of this hook used by webtask server.
Show child attributes
Show child attributes