C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await foreach (var item in client.Events.SubscribeAsync(
new SubscribeEventsRequestParameters {
From = "from",
FromTimestamp = "from_timestamp",
EventType = new List<EventStreamSubscribeEventsEventTypeEnum>(){
EventStreamSubscribeEventsEventTypeEnum.ConnectionCreated,
}
}
))
{
/* consume each item */
}
;
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.types.EventStreamSubscribeEventsEventTypeEnum;
import com.auth0.client.mgmt.types.SubscribeEventsRequestParameters;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.events().subscribe(
SubscribeEventsRequestParameters
.builder()
.eventType(
Arrays.asList(EventStreamSubscribeEventsEventTypeEnum.CONNECTION_CREATED)
)
.from("from")
.fromTimestamp("from_timestamp")
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Events\Requests\SubscribeEventsRequestParameters;
use Auth0\SDK\API\Management\Types\EventStreamSubscribeEventsEventTypeEnum;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->events->subscribe(
new SubscribeEventsRequestParameters([
'from' => 'from',
'fromTimestamp' => 'from_timestamp',
'eventType' => [
EventStreamSubscribeEventsEventTypeEnum::ConnectionCreated->value,
],
]),
);
from auth0.management import ManagementClient
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.events.subscribe(
from="from",
from_timestamp="from_timestamp",
event_type=[
"connection.created"
],
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.events.subscribe(
from: "from",
from_timestamp: "from_timestamp",
event_type: ["connection.created"]
)
curl --request GET \
--url https://{tenantDomain}/api/v2/events \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenantDomain}/api/v2/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenantDomain}/api/v2/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"event": {
"a0stream": "<string>",
"a0tenant": "<string>",
"data": {
"object": {
"id": "<string>",
"name": "<string>",
"strategy": "oidc",
"authentication": {
"active": true
},
"connected_accounts": {
"active": true,
"cross_app_access": true
},
"display_name": "<string>",
"enabled_clients": [
"<string>"
],
"is_domain_connection": true,
"metadata": {},
"options": {
"client_id": "<string>",
"attribute_map": {
"attributes": {},
"userinfo_scope": "<string>"
},
"authorization_endpoint": "<string>",
"connection_settings": {},
"discovery_url": "<string>",
"domain_aliases": [
"<string>"
],
"federated_connections_access_tokens": {
"active": true
},
"icon_url": "<string>",
"id_token_session_expiry_supported": true,
"id_token_signed_response_algs": [],
"issuer": "<string>",
"jwks_uri": "<string>",
"non_persistent_attrs": [
"<string>"
],
"oidc_metadata": {
"authorization_endpoint": "<string>",
"id_token_signing_alg_values_supported": [
"<string>"
],
"issuer": "<string>",
"jwks_uri": "<string>",
"acr_values_supported": [
"<string>"
],
"claim_types_supported": [
"<string>"
],
"claims_locales_supported": [
"<string>"
],
"claims_parameter_supported": true,
"claims_supported": [
"<string>"
],
"display_values_supported": [
"<string>"
],
"dpop_signing_alg_values_supported": [
"<string>"
],
"end_session_endpoint": "<string>",
"grant_types_supported": [
"<string>"
],
"id_token_encryption_alg_values_supported": [
"<string>"
],
"id_token_encryption_enc_values_supported": [
"<string>"
],
"op_policy_uri": "<string>",
"op_tos_uri": "<string>",
"registration_endpoint": "<string>",
"request_object_encryption_alg_values_supported": [
"<string>"
],
"request_object_encryption_enc_values_supported": [
"<string>"
],
"request_object_signing_alg_values_supported": [
"<string>"
],
"request_parameter_supported": true,
"request_uri_parameter_supported": true,
"require_request_uri_registration": true,
"response_modes_supported": [
"<string>"
],
"response_types_supported": [
"<string>"
],
"scopes_supported": [
"<string>"
],
"service_documentation": "<string>",
"subject_types_supported": [
"<string>"
],
"token_endpoint": "<string>",
"token_endpoint_auth_methods_supported": [
"<string>"
],
"token_endpoint_auth_signing_alg_values_supported": [
"<string>"
],
"ui_locales_supported": [
"<string>"
],
"userinfo_encryption_alg_values_supported": [
"<string>"
],
"userinfo_encryption_enc_values_supported": [
"<string>"
],
"userinfo_endpoint": "<string>",
"userinfo_signing_alg_values_supported": [
"<string>"
]
},
"scope": "<string>",
"send_back_channel_nonce": true,
"tenant_domain": "<string>",
"token_endpoint": "<string>",
"upstream_params": {},
"userinfo_endpoint": "<string>"
},
"realms": [
"<string>"
],
"show_as_button": true
},
"context": {
"tenant": {
"tenant_id": "<string>"
},
"client": {
"id": "<string>",
"metadata": {},
"name": "<string>"
},
"connection": {
"id": "<string>",
"name": "<string>",
"strategy": "<string>"
},
"request": {
"geo": {
"city_name": "<string>",
"continent_code": "<string>",
"country_code": "<string>",
"country_name": "<string>",
"latitude": 123,
"longitude": 123,
"subdivision_code": "<string>",
"subdivision_name": "<string>",
"time_zone": "<string>"
},
"hostname": "<string>",
"ip": "<string>",
"method": "<string>",
"user_agent": "<string>",
"custom_domain": "<string>"
}
}
},
"id": "<string>",
"source": "<string>",
"specversion": "1.0",
"time": "2023-11-07T05:31:56Z",
"type": "connection.created",
"a0purpose": "test"
},
"offset": "<string>",
"type": "connection.created"
}イベントを購読
Server-Sent Events (SSE) 経由でイベントを購読する
GET
https://{tenantDomain}/api/v2
/
events
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await foreach (var item in client.Events.SubscribeAsync(
new SubscribeEventsRequestParameters {
From = "from",
FromTimestamp = "from_timestamp",
EventType = new List<EventStreamSubscribeEventsEventTypeEnum>(){
EventStreamSubscribeEventsEventTypeEnum.ConnectionCreated,
}
}
))
{
/* consume each item */
}
;
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.types.EventStreamSubscribeEventsEventTypeEnum;
import com.auth0.client.mgmt.types.SubscribeEventsRequestParameters;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.events().subscribe(
SubscribeEventsRequestParameters
.builder()
.eventType(
Arrays.asList(EventStreamSubscribeEventsEventTypeEnum.CONNECTION_CREATED)
)
.from("from")
.fromTimestamp("from_timestamp")
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Events\Requests\SubscribeEventsRequestParameters;
use Auth0\SDK\API\Management\Types\EventStreamSubscribeEventsEventTypeEnum;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->events->subscribe(
new SubscribeEventsRequestParameters([
'from' => 'from',
'fromTimestamp' => 'from_timestamp',
'eventType' => [
EventStreamSubscribeEventsEventTypeEnum::ConnectionCreated->value,
],
]),
);
from auth0.management import ManagementClient
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.events.subscribe(
from="from",
from_timestamp="from_timestamp",
event_type=[
"connection.created"
],
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.events.subscribe(
from: "from",
from_timestamp: "from_timestamp",
event_type: ["connection.created"]
)
curl --request GET \
--url https://{tenantDomain}/api/v2/events \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenantDomain}/api/v2/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenantDomain}/api/v2/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"event": {
"a0stream": "<string>",
"a0tenant": "<string>",
"data": {
"object": {
"id": "<string>",
"name": "<string>",
"strategy": "oidc",
"authentication": {
"active": true
},
"connected_accounts": {
"active": true,
"cross_app_access": true
},
"display_name": "<string>",
"enabled_clients": [
"<string>"
],
"is_domain_connection": true,
"metadata": {},
"options": {
"client_id": "<string>",
"attribute_map": {
"attributes": {},
"userinfo_scope": "<string>"
},
"authorization_endpoint": "<string>",
"connection_settings": {},
"discovery_url": "<string>",
"domain_aliases": [
"<string>"
],
"federated_connections_access_tokens": {
"active": true
},
"icon_url": "<string>",
"id_token_session_expiry_supported": true,
"id_token_signed_response_algs": [],
"issuer": "<string>",
"jwks_uri": "<string>",
"non_persistent_attrs": [
"<string>"
],
"oidc_metadata": {
"authorization_endpoint": "<string>",
"id_token_signing_alg_values_supported": [
"<string>"
],
"issuer": "<string>",
"jwks_uri": "<string>",
"acr_values_supported": [
"<string>"
],
"claim_types_supported": [
"<string>"
],
"claims_locales_supported": [
"<string>"
],
"claims_parameter_supported": true,
"claims_supported": [
"<string>"
],
"display_values_supported": [
"<string>"
],
"dpop_signing_alg_values_supported": [
"<string>"
],
"end_session_endpoint": "<string>",
"grant_types_supported": [
"<string>"
],
"id_token_encryption_alg_values_supported": [
"<string>"
],
"id_token_encryption_enc_values_supported": [
"<string>"
],
"op_policy_uri": "<string>",
"op_tos_uri": "<string>",
"registration_endpoint": "<string>",
"request_object_encryption_alg_values_supported": [
"<string>"
],
"request_object_encryption_enc_values_supported": [
"<string>"
],
"request_object_signing_alg_values_supported": [
"<string>"
],
"request_parameter_supported": true,
"request_uri_parameter_supported": true,
"require_request_uri_registration": true,
"response_modes_supported": [
"<string>"
],
"response_types_supported": [
"<string>"
],
"scopes_supported": [
"<string>"
],
"service_documentation": "<string>",
"subject_types_supported": [
"<string>"
],
"token_endpoint": "<string>",
"token_endpoint_auth_methods_supported": [
"<string>"
],
"token_endpoint_auth_signing_alg_values_supported": [
"<string>"
],
"ui_locales_supported": [
"<string>"
],
"userinfo_encryption_alg_values_supported": [
"<string>"
],
"userinfo_encryption_enc_values_supported": [
"<string>"
],
"userinfo_endpoint": "<string>",
"userinfo_signing_alg_values_supported": [
"<string>"
]
},
"scope": "<string>",
"send_back_channel_nonce": true,
"tenant_domain": "<string>",
"token_endpoint": "<string>",
"upstream_params": {},
"userinfo_endpoint": "<string>"
},
"realms": [
"<string>"
],
"show_as_button": true
},
"context": {
"tenant": {
"tenant_id": "<string>"
},
"client": {
"id": "<string>",
"metadata": {},
"name": "<string>"
},
"connection": {
"id": "<string>",
"name": "<string>",
"strategy": "<string>"
},
"request": {
"geo": {
"city_name": "<string>",
"continent_code": "<string>",
"country_code": "<string>",
"country_name": "<string>",
"latitude": 123,
"longitude": 123,
"subdivision_code": "<string>",
"subdivision_name": "<string>",
"time_zone": "<string>"
},
"hostname": "<string>",
"ip": "<string>",
"method": "<string>",
"user_agent": "<string>",
"custom_domain": "<string>"
}
}
},
"id": "<string>",
"source": "<string>",
"specversion": "1.0",
"time": "2023-11-07T05:31:56Z",
"type": "connection.created",
"a0purpose": "test"
},
"offset": "<string>",
"type": "connection.created"
}承認
bearerAuthoAuth2ClientCredentials
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
クエリパラメータ
ストリーム内の位置を表す opaque なトークンです。指定しない場合、ストリームは最新のイベントから開始されます。
Maximum string length:
1024イベントのストリーミング開始位置を示す RFC-3339 タイムスタンプです。これは、カーソルを利用できない可能性がある初回クエリでのみ使用してください。後続の request では、より正確なカーソル (from) を使用してください。
Maximum string length:
20受信するイベントタイプ。複数のタイプを指定する場合は、複数回指定してください(例: ?event_type=user.created&event_type=user.updated)。指定しない場合は、すべてのイベントタイプがストリーミングされます。 受信するイベントタイプ。複数のタイプを指定する場合は、複数回指定してください(例: ?event_type=user.created&event_type=user.updated)。指定しない場合は、すべてのイベントタイプがストリーム配信されます。
利用可能なオプション:
connection.created, connection.deleted, connection.updated, group.created, group.deleted, group.member.added, group.member.deleted, group.role.assigned, group.role.deleted, group.updated, organization.connection.added, organization.connection.removed, organization.connection.updated, organization.created, organization.deleted, organization.group.role.assigned, organization.group.role.deleted, organization.member.added, organization.member.deleted, organization.member.role.assigned, organization.member.role.deleted, organization.updated, user.created, user.deleted, user.updated レスポンス
イベントストリームが正常に確立されました。
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
各SSEデータ行で配信されるJSON payload。typeフィールドは、SDKによってSSEのeventフィールドから注入されます。typeによって判別され、イベントの場合はイベントタイプ名、エラーの場合は"error"、カーソルのみのハートビートの場合は"offset-only"になります。
⌘I