|
1 | | -# Send Auth0 Logs Streams to Tinybird |
2 | | - |
3 | | -[Auth0](https://auth0.com) is a developer-focused user management platform to handle user authentication with many prebuilt UI components. By integrating Auth0 with Tinybird, you can analyze your user authentication data in real time and enrich it with other data sources. |
4 | | - |
5 | | -Some common use cases for sending Auth0 logs to Tinybird include: |
6 | | - |
7 | | -1. Tracking net user and organization growth. |
8 | | -2. Monitoring user churn. |
9 | | -3. Identifying common auth errors. |
10 | | -4. Creating custom dashboards for auth analysis. |
11 | | -5. User authentication audit logs. |
12 | | - |
13 | | -Read on to learn how to send data from Auth0 Logs Streams to Tinybird. |
14 | | - |
15 | | -## Before you start |
16 | | - |
17 | | -Before you connect Auth0 Logs Streams to Tinybird, ensure: |
18 | | - |
19 | | -* You have an Auth0 account. |
20 | | -* You have a Tinybird Workspace. |
21 | | - |
22 | | -## Connect Auth0 to Tinybird |
| 1 | +# Connect Auth0 to Tinybird |
23 | 2 |
|
24 | 3 | 1. From the Auth0 dashboard, select **Monitoring** > **Streams**. |
25 | 4 |
|
26 | 5 | 2. Select **Create Stream**. |
27 | 6 |
|
28 | | -3. In Tinybird, create a Data Source, called `auth0_logs` in this example, with the following schema: |
29 | | - |
30 | | -```tb {% title = 'Data Source schema for Auth0 logs streams %} |
31 | | -SCHEMA > |
32 | | - `log_id` String `json:$.log_id`, |
33 | | - `type` String `json:$.data.type` DEFAULT 'unknown', |
34 | | - `date` DateTime64(3) `json:$.data.date` DEFAULT now(), |
35 | | - `client_name` LowCardinality(String) `json:$.data.client_name` DEFAULT 'unknown', |
36 | | - `user_id` String `json:$.data.user_id` DEFAULT 'unknown', |
37 | | - `connection_id` Nullable(String) `json:$.data.connection_id`, |
38 | | - `ip` Nullable(String) `json:$.data.ip`, |
39 | | - `data_log_id` Nullable(String) `json:$.data.log_id`, |
40 | | - `user_name` Nullable(String) `json:$.data.user_name`, |
41 | | - `client_id` Nullable(String) `json:$.data.client_id`, |
42 | | - `client_ip` Nullable(String) `json:$.data.client_ip`, |
43 | | - `tenant_name` Nullable(String) `json:$.data.tenant_name`, |
44 | | - `description` Nullable(String) `json:$.data.description`, |
45 | | - `connection` Nullable(String) `json:$.data.connection`, |
46 | | - `audience` Nullable(String) `json:$.data.audience`, |
47 | | - `scope` Array(Nullable(String)) `json:$.data.scope[:]`, |
48 | | - `user_agent` Nullable(String) `json:$.data.user_agent`, |
49 | | - `hostname` Nullable(String) `json:$.data.hostname`, |
50 | | - `strategy` Nullable(String) `json:$.data.strategy`, |
51 | | - `strategy_type` Nullable(String) `json:$.data.strategy_type`, |
52 | | - `tracking_id` Nullable(String) `json:$.data.tracking_id`, |
53 | | - `event_schema_version` Nullable(String) `json:$.data.['$event_schema'].version`, |
54 | | - `auth0_client` JSON `json:$.data.auth0_client` DEFAULT '{}', |
55 | | - `details` JSON `json:$.data.details` DEFAULT '{}' |
56 | | -
|
57 | | -ENGINE "MergeTree" |
58 | | -ENGINE_PARTITION_KEY "toYYYYMM(date)" |
59 | | -ENGINE_SORTING_KEY "type, user_id, date" |
60 | | -``` |
61 | | - |
62 | | -Using the [JSON Data Type](/sql-reference/data-types/json) you can store the semi-structured data you receive from Auth0 Logs Streams in a single column. You can later retrieve various events and their metadata as needed in your Pipes. |
63 | | - |
64 | | -4. In Tinybird, copy a token with privileges to append to the Data Source you created. You can use the admin token or create one with the required scope. |
| 7 | +3. In Tinybird, go to Tokens, and copy the `append` token. |
65 | 8 |
|
66 | | -5. Back in Auth0, paste the Events API URL in your Webhook Endpoint URL. Use the query parameter `name` to match the name of the Data Source you created in Tinybird. For example: |
| 9 | +4. Back in Auth0, paste the Events API URL in your Webhook Endpoint URL. Use the query parameter `name=auth0` and `token=<your token>`. For example: |
67 | 10 |
|
68 | 11 | ``` |
69 | | -https://api.tinybird.co/v0/events?name=auth0_logs&token=TOKEN |
| 12 | +https://api.tinybird.co/v0/events?name=auth0&token=TOKEN |
70 | 13 | ``` |
71 | 14 |
|
72 | 15 | Content Type is `application/json` and Content Format is `JSON Lines`. |
73 | 16 |
|
74 | | -1. Select the any event category to filter, like `All`, and a date in case you want to perform some backfilling. Then select **Save**. |
| 17 | +5. Select the any event category to filter, like `All`, and a date in case you want to perform some backfilling. Then select **Save**. |
75 | 18 |
|
76 | 19 | 2. You're done. Any of the Auth0 Log Streams events you selected is automatically sent to Tinybird through the [Events API](https://tinybird.co/docs/get-data-in/ingest-apis/events-api). |
77 | 20 |
|
78 | | -You can check the status of the integration from the **Health** tab in the created webhook or from the **Log** tab in the Tinybird `auth0_logs` Data Source. |
| 21 | +You can check the status of the integration from the **Health** tab in the created webhook or from the **Log** tab in the Tinybird `auth0` Data Source. |
79 | 22 |
|
80 | 23 | ## See also |
81 | 24 |
|
|
0 commit comments