C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Actions;
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.Actions.Modules.CreateAsync(
new CreateActionModuleRequestContent {
Name = "name",
Code = "code"
}
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.actions.types.CreateActionModuleRequestContent;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.actions().modules().create(
CreateActionModuleRequestContent
.builder()
.name("name")
.code("code")
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Actions\Modules\Requests\CreateActionModuleRequestContent;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->actions->modules->create(
new CreateActionModuleRequestContent([
'name' => 'name',
'code' => 'code',
]),
);
from auth0.management import ManagementClient
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.actions.modules.create(
name="name",
code="code",
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.actions.modules.create(
name: "name",
code: "code"
)
curl --request POST \
--url https://{tenantDomain}/api/v2/actions/modules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"name": "<string>",
"api_version": "<string>",
"dependencies": [
{
"name": "<string>",
"version": "<string>"
}
],
"publish": true,
"secrets": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
name: '<string>',
api_version: '<string>',
dependencies: [{name: '<string>', version: '<string>'}],
publish: true,
secrets: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://{tenantDomain}/api/v2/actions/modules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenantDomain}/api/v2/actions/modules"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"api_version\": \"<string>\",\n \"dependencies\": [\n {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n }\n ],\n \"publish\": true,\n \"secrets\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"actions_using_module_total": 123,
"all_changes_published": true,
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"dependencies": [
{
"name": "<string>",
"version": "<string>"
}
],
"id": "<string>",
"latest_version": {
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"dependencies": [
{
"name": "<string>",
"version": "<string>"
}
],
"id": "<string>",
"secrets": [
{
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"version_number": 123
},
"latest_version_number": 123,
"name": "<string>",
"secrets": [
{
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"updated_at": "2023-11-07T05:31:56Z"
}新しいAuth0 Actions Moduleを作成
actions 間で再利用できるコード用の新しい Auth0 Actions Module を作成します。
POST
https://{tenantDomain}/api/v2
/
actions
/
modules
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Actions;
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.Actions.Modules.CreateAsync(
new CreateActionModuleRequestContent {
Name = "name",
Code = "code"
}
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.actions.types.CreateActionModuleRequestContent;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.actions().modules().create(
CreateActionModuleRequestContent
.builder()
.name("name")
.code("code")
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Actions\Modules\Requests\CreateActionModuleRequestContent;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->actions->modules->create(
new CreateActionModuleRequestContent([
'name' => 'name',
'code' => 'code',
]),
);
from auth0.management import ManagementClient
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.actions.modules.create(
name="name",
code="code",
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.actions.modules.create(
name: "name",
code: "code"
)
curl --request POST \
--url https://{tenantDomain}/api/v2/actions/modules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"name": "<string>",
"api_version": "<string>",
"dependencies": [
{
"name": "<string>",
"version": "<string>"
}
],
"publish": true,
"secrets": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: '<string>',
name: '<string>',
api_version: '<string>',
dependencies: [{name: '<string>', version: '<string>'}],
publish: true,
secrets: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://{tenantDomain}/api/v2/actions/modules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenantDomain}/api/v2/actions/modules"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"name\": \"<string>\",\n \"api_version\": \"<string>\",\n \"dependencies\": [\n {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n }\n ],\n \"publish\": true,\n \"secrets\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"actions_using_module_total": 123,
"all_changes_published": true,
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"dependencies": [
{
"name": "<string>",
"version": "<string>"
}
],
"id": "<string>",
"latest_version": {
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"dependencies": [
{
"name": "<string>",
"version": "<string>"
}
],
"id": "<string>",
"secrets": [
{
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"version_number": 123
},
"latest_version_number": 123,
"name": "<string>",
"secrets": [
{
"name": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"updated_at": "2023-11-07T05:31:56Z"
}承認
bearerAuthoAuth2ClientCredentials
ボディ
application/jsonapplication/x-www-form-urlencoded
レスポンス
action module を作成しました。