You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/server/node/index.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -653,6 +653,46 @@ analytics.track({
653
653
```
654
654
655
655
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';
If you're having issues with threads outliving your request, check [Background threads and synchronous mode](#background-threads-and-synchronous-mode)
538
538
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
+
withopen("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
0 commit comments