Skip to content

Commit ffc7684

Browse files
authored
Merge pull request #5964 from segmentio/master
master back to develop after OAuth merge
2 parents 612e603 + b664372 commit ffc7684

File tree

15 files changed

+901
-151
lines changed

15 files changed

+901
-151
lines changed

src/_data/sidenav/main.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ sections:
260260
title: Speeding Up Redshift Queries
261261
- path: /connections/storage/warehouses/redshift-useful-sql
262262
title: Useful SQL Queries for Redshift
263+
- path: /connections/regional-segment
264+
title: Regional Segment
263265
- path: /connections/test-connections
264266
title: Event Tester
265267
- path: /connections/data-export-options
@@ -276,18 +278,6 @@ sections:
276278
title: Integration Error Codes
277279
- path: /connections/rate-limits
278280
title: Rate Limits
279-
- path: /connections/regional-segment
280-
title: Regional Segment
281-
# - section_title: Reverse ETL
282-
# section:
283-
# - path: /reverse-etl
284-
# title: Reverse ETL Overview
285-
# - path: /reverse-etl/bigquery-setup
286-
# title: BigQuery Reverse ETL Setup
287-
# - path: /reverse-etl/redshift-setup
288-
# title: Redshift Reverse ETL Setup
289-
# - path: /reverse-etl/snowflake-setup
290-
# title: Snowflake Reverse ETL Setup
291281
- section_title: Unify
292282
section:
293283
- path: /unify
@@ -324,9 +314,9 @@ sections:
324314
title: Tables & Materialized Views
325315
- section_title: Linked Profiles
326316
slug: unify/linked-profiles
327-
section:
328-
- path: /unify/linked-profiles/linked-events
329-
title: Linked Events
317+
section:
318+
- path: /unify/linked-profiles
319+
title: Linked Profiles Overview
330320
- section_title: Setup Guides
331321
slug: unify/linked-profiles/setup-guides
332322
section:
@@ -336,6 +326,11 @@ sections:
336326
title: Snowflake Setup
337327
- path: /unify/linked-profiles/setup-guides/redshift-setup
338328
title: Redshift Setup
329+
- path: /unify/linked-profiles/data-graph
330+
title: Data Graph
331+
- path: /unify/linked-profiles/linked-events
332+
title: Linked Events
333+
339334
- section_title: Traits
340335
slug: unify/traits
341336
section:
@@ -402,6 +397,8 @@ sections:
402397
title: Account-level Audiences
403398
- path: '/engage/audiences/generative-audiences'
404399
title: Generative Audiences
400+
- path: '/engage/audiences/linked-audiences'
401+
title: Linked Audiences
405402
- path: '/engage/audiences/organization'
406403
title: Organize Audiences
407404

src/api/public-api/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Learn more about [GitHub's secret scanning program](https://docs.github.com/en/d
4242
## OAuth 2.0
4343

4444
> info ""
45-
> This feature is currently in pilot and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
45+
> OAuth 2.0 is currently in private beta and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
4646
4747
## FAQs
4848
#### What should I do if I see a notification that my token was exposed?

src/connections/functions/source-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ Copy and paste this URL into the upstream tool or service to send data to this s
390390
## OAuth 2.0
391391

392392
> info ""
393-
> OAuth 2.0 is currently in pilot and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
393+
> OAuth 2.0 is currently in private beta and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
394394
395395
## Source function FAQs
396396

src/connections/oauth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ hidden: true
66
OAuth 2.0 is an online authorization standard that uses tokens to grant access to API resources like Segment’s tracking API. You can use OAuth 2.0 as a security requirement for connections to third-party tools.
77

88
> info ""
9-
> This feature is currently in pilot and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}. OAuth 2.0 only supports server to Segment communication, a machine-to-machine workflow. Take a look at the [supported sources](#supported-sources) to see what sources Segment supports.
9+
> OAuth 2.0 is currently in private beta and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}. OAuth 2.0 only supports server to Segment communication, a machine-to-machine workflow. Take a look at the [supported sources](#supported-sources) to see what sources Segment supports.
1010
1111
## Permissions
1212
Depending on your workspace permissions, your access to OAuth apps is limited.
@@ -134,4 +134,4 @@ OAuth 2.0 currently supports these scopes:
134134
* `functions:write`
135135

136136
**Public API scopes**
137-
* `public_api:read_write`
137+
* `public_api:read_write`

src/connections/sources/catalog/libraries/server/node/index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,46 @@ analytics.track({
653653
```
654654
655655
656+
## OAuth 2.0
657+
658+
> info ""
659+
> OAuth 2.0 is currently in private beta and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
660+
661+
Enable [OAuth 2.0](/docs/connections/oauth/) in your Segment workspace to guarantee authorized communication between your server environment and Segment's Tracking API. To support the non-interactive server environment, the OAuth workflow used is a signed client assertion JWT.
662+
663+
You will need a public and private key pair where:
664+
- The public key is uploaded to the Segment dashboard.
665+
- The private key is kept in your server environment to be used by this SDK.
666+
667+
Your server will verify its identity by signing a token request and will receive a token that is used to to authorize all communication with the Segment Tracking API.
668+
669+
You'll need to provide the OAuth Application ID and the public key's ID, both of which are provided in the Segment dashboard. There are also options available to specify the authorization server, custom scope, maximum number of retries, or a custom HTTP client if your environment has special rules for separate Segment endpoints.
670+
671+
Be sure to implement handling for Analytics SDK errors. Good logging helps distinguish any configuration issues.
672+
673+
For more information, see the [Segment OAuth 2.0 documentation](/docs/connections/oauth/).
674+
675+
```ts
676+
import { Analytics, OAuthSettings } from '@segment/analytics-node';
677+
import { readFileSync } from 'fs'
678+
679+
const privateKey = readFileSync('private.pem', 'utf8')
680+
681+
const settings: OAuthSettings = {
682+
clientId: '<CLIENT_ID_FROM_DASHBOARD>',
683+
clientKey: privateKey,
684+
keyId: '<PUB_KEY_ID_FROM_DASHBOARD>',
685+
}
686+
687+
const analytics = new Analytics({
688+
writeKey: '<MY_WRITE_KEY>',
689+
oauthSettings: settings,
690+
})
691+
692+
analytics.on('error', (err) => { console.error(err) })
693+
694+
analytics.track({ userId: 'foo', event: 'bar' })
695+
```
656696
## Troubleshooting
657697
658698
{% include content/troubleshooting-intro.md %}

src/connections/sources/catalog/libraries/server/python/index.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,49 @@ analytics.write_key = 'YOUR_WRITE_KEY'
530530

531531
## Google App Engine
532532

533-
Google App Engine my not resolve project dependencies. If this is the case add the following to your project alongside analytics-python:
533+
Google App Engine may not resolve project dependencies. If this is the case add the following to your project alongside analytics-python:
534534
- [requests](https://github.com/kennethreitz/requests){:target="_blank"}
535535
- python-dateutil](https://github.com/paxan/python-dateutil){:target="_blank"}
536536

537537
If you're having issues with threads outliving your request, check [Background threads and synchronous mode](#background-threads-and-synchronous-mode)
538538

539+
## OAuth 2.0
540+
541+
> info ""
542+
> OAuth 2.0 is currently in private beta and is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
543+
544+
Enable [OAuth 2.0](/docs/connections/oauth/) in your Segment workspace to guarantee authorized communication between your server environment and Segment's Tracking API. To support the non-interactive server environment, the OAuth workflow used is a signed client assertion JWT.
545+
546+
You will need a public and private key pair where:
547+
- The public key is uploaded to the Segment dashboard.
548+
- The private key is kept in your server environment to be used by this SDK.
549+
Your server will verify its identity by signing a token request and will receive a token that is used to to authorize all communication with the Segment Tracking API.
550+
551+
You'll need to provide the OAuth Application ID and the public key's ID, both of which are provided in the Segment dashboard. There are also options available to specify the authorization server, custom scope, maximum number of retries, or a custom HTTP client if your environment has special rules for separate segment endpoints.
552+
553+
Be sure to implement handling for Analytics SDK errors. Good logging will help distinguish any configuration issues.
554+
555+
For more information, see the [Segment OAuth 2.0 documentation](/docs/connections/oauth/).
556+
557+
```python
558+
import segment.analytics as analytics
559+
with open("private_key.pem") as f:
560+
privatekey = f.read()
561+
562+
analytics.write_key = '<YOUR WRITE KEY HERE>'
563+
564+
analytics.oauth_client_id = 'CLIENT_ID' # OAuth application ID from segment dashboard
565+
analytics.oauth_client_key = privatekey # generated as a public/private key pair in PEM format from OpenSSL
566+
analytics.oauth_key_id = 'KEY_ID' # From segment dashboard after uploading public key
567+
568+
def on_error(error, items):
569+
print("An error occurred: ", error)
570+
analytics.on_error = on_error
571+
572+
analytics.track('AUser', 'track')
573+
analytics.flush()
574+
```
575+
539576
## Troubleshooting
540577

541578
### Request size limits

0 commit comments

Comments
 (0)