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/partners/enable-with-segment.md
+24-24Lines changed: 24 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,25 @@
2
2
title: Enable with OAuth
3
3
---
4
4
5
-
Enable with OAuth, supported with the [Public API](/docs/api/public-api), allows partners to build seamless flows for customers to implement and enable integrations within their workspace. This is a [post-launch requirement](/docs/partners/#post-launch) for a partner to graduate from public beta to public.
5
+
Enable with OAuth, supported with the [Config API](/docs/api/config-api), allows partners to build seamless flows for customers to implement and enable integrations within their workspace.
6
6
7
7
## Concepts
8
8
9
9
Before getting started with your implementation, it's important to understand the below concepts.
10
10
11
11
### Apps
12
12
13
-
As a partner developing an integration using Segment's Public API, everything starts from an **App**. An App behaves like a standard OAuth client, but adds granular permissions. When a user installs your App through the familiar OAuth flow, Segment requires the user to grant access to a specific workspace and source. The user must also be a Workspace Owner of the authorized workspace.
13
+
As a partner developing an integration using Segment's Config API, everything starts from an **App**. An App behaves like a standard OAuth client, but adds granular permissions. When a user installs your App through the familiar OAuth flow, Segment requires the user to grant access to a specific workspace and source. The user must also be a Workspace Owner of the authorized workspace.
14
14
15
15
As a destination partner, you may only manage your own destination on the workspace and source authorized by the user.
16
16
17
-
### App Installs
17
+
### App installs
18
18
19
19
Segment Workspace Owners authorize your App on their workspace using a web-based authorization flow, exactly like OAuth. When authorized, Segment creates an **App Install** on the workspace.
20
20
21
21
Therefore, the token returned by Segment isn't tied to a user – it's tied to an App Install.
22
22
23
-
## Set up Guide
23
+
## Set up guide
24
24
25
25
There are three steps to implement an "Enable with Segment" OAuth flow:
26
26
@@ -35,21 +35,21 @@ There are three steps to implement an "Enable with Segment" OAuth flow:
35
35

36
36
3. Name your App, and click **Create**.
37
37

38
-
You'll be redirected to your App's main page. If you are implementing Enable with OAuth for an integration not built using the Developer Center and encounter an issue where your integration's name is already taken, you may choose another name (eg. TOOLNAME-enable). You will have the option to connect the two by selecting a scope in Step #2.
38
+
You'll be redirected to your App's main page. If you are implementing Enable with OAuth for an integration not built using the Developer Center and encounter an issue where your integration's name is already taken, you may choose another name (for example, TOOLNAME-enable). You will have the option to connect the two by selecting a scope in Step #2.
39
39
4. Click the `App Info` tab.
40
40

41
41
5. From the `App Info` tab, click `OAuth` in the left side navigation.
42
42

43
-
6. Keep your Developer Center browser window open – we'll need the OAuth credentials on this page to set up an OAuth consumer.
43
+
6. Keep your Developer Center browser window open – Segment needs the OAuth credentials on this page to set up an OAuth consumer.
44
44

45
45
46
46
### 2. Set up an OAuth consumer
47
47
48
-
> For this step, we reference our example OAuth consumer at https://github.com/segmentio/partnerapp.
48
+
> For this step, reference Segment's example OAuth consumer at https://github.com/segmentio/partnerapp.
49
49
>
50
-
> You should adapt our example to your own infrastructure.
50
+
> You should adapt Segment's example to your own infrastructure.
51
51
52
-
1. Clone our`partnerapp` repo:
52
+
1. Clone Segment's`partnerapp` repo:
53
53
```sh
54
54
git clone https://github.com/segmentio/partnerapp
55
55
```
@@ -66,17 +66,17 @@ There are three steps to implement an "Enable with Segment" OAuth flow:
66
66
4. Optionally set a new scope. The options, from most to least restrictive are:
67
67
*`destination/<SLUG>` (e.g. `destination/airship`) -- create or update a single destination type on a single source a user consents to. This allows you to manage a secret like `apiKey` on your company's destination automatically but nothing else. Note that you may need to update the scope to the right destination slug if your app name differs.
68
68
*`workspace:read` -- read-only access to all the settings and metadata on a single workspace a user consents to. This allows you to build integrations like a dashboard that gets and displays a workspace event delivery metrics
69
-
*`workspace` -- full acess to all the settings on a single workspace a user consents to. This allows you to build deep integrations that create sources, destinations and more.
69
+
*`workspace` -- full access to all the settings on a single workspace a user consents to. This allows you to build deep integrations that create sources, destinations, and more.
70
70
5. Finally, create a component of your choice in Developer Center.
71
71

72
72
73
73
> You generally will create a component and build a flow to create an Install of your app. However you can also build a flow to create an install of an existing destination by changing the OAuth scope.
74
74
75
75
### 3. Run through an example OAuth flow
76
76
77
-
> For this step, we reference our example OAuth consumer at https://github.com/segmentio/partnerapp.
77
+
> For this step, reference Segment's example OAuth consumer at https://github.com/segmentio/partnerapp.
78
78
>
79
-
> You should adapt our example to your own infrastructure.
79
+
> You should adapt Segment's example to your own infrastructure.
80
80
81
81
1. Back in the root directory of your `partnerapp` clone, update the following two pieces of configuration in `index.js`:
82
82
```js
@@ -93,22 +93,22 @@ There are three steps to implement an "Enable with Segment" OAuth flow:
93
93
```sh
94
94
node index.js
95
95
```
96
-
3. Navigate through our login and authorize OAuth flows:
96
+
3. Navigate through Segment's login and authorize OAuth flows:
97
97

98
98
4. Look for a JSON response in your browser window, and output in the terminal running `partnerapp`:
99
99

100
100

101
101
102
-
## OAuth Implementation
102
+
## OAuth implementation
103
103
104
104
If you use a standard OAuth library in your programming language, all of this is done for you as shown in the [setup guide](#set-up-guide). These steps are just for illustration.
105
105
106
106
1. When the user wants to authenticate, you redirect them to `https://id.segmentapis.com/oauth2/auth?response_type=code&scope=workspace:read&client_id=...`.
107
-
> **Note**: We only accept`response_type=code` here. That means Segment returns an `auth_code` that your library exchanges for an install token in Step 5 below.
107
+
> **Note**: Segment only accepts`response_type=code` here. That means Segment returns an `auth_code` that your library exchanges for an install token in Step 5 below.
108
108
2. If the user is logged out, Segment redirects to `https://app.segment.com/login`
109
109
3. If the user is logged in, Segment redirects to `https://app.segment.com/authorize`
110
110
4. If user consents, Segment redirects with a code to your redirect_uri `http://localhost:8888/auth/segment/callback`. This app listens for this request and runs step #5 below.
111
-
5. You exchange the code with for an install token from `https://id.segmentapis.com/oauth2/token`. The body of this POST request should include the code you received and your `redirect_uri`. Include your client secret and client id in a basic authorization header.
111
+
5. You exchange the code for an install token from `https://id.segmentapis.com/oauth2/token`. The body of this POST request should include the code you received and your `redirect_uri`. Include your client secret and client id in a basic authorization header.
112
112
6. You save the access token, install name, workspace name and source name for the user.
113
113
114
114
At the end of a successful flow you get an "Install Token". If you passed in the scope as `destination/clearbrain` the user is prompted to select a source on which to install your Enable With Segment App, and that source is returned to you as well.
@@ -130,7 +130,7 @@ You can then perform API operations as the installed app on behalf a user.
130
130
131
131
With the `destination/clearbrain` scope you can only change the destination specified (`clearbrain` in this case) on the user selected source. This is the recommended scope for apps trying to control just one destination for a user (Enable With Segment functionality). These apps can only access the Destinations API. You can find a detailed reference here: https://reference.segmentapis.com/ > Destinations
132
132
133
-
You can GET a destination if it exists (and you have access to the user workspace and source) as shown below. You can also Create, Update or Delete it too.
133
+
You can GET a destination if it exists (and you have access to the user workspace and source) as shown below. You can also Create, Update, or Delete it too.
> Developer Center Destinations must use their specific destination scope for their enable flows. More permissive apps are subject to revocation unless specifically approved. If you've been approved, however, this section may apply.
185
185
@@ -188,7 +188,7 @@ If you created an App with a more permissive scope, you have access to more APIs
188
188
- With the `workspace` scope you can change all resources
189
189
- With the `workspace:read` you can read all resources, but not change them
190
190
191
-
A full list of APIs are here: https://segment.com/docs/api/public-api/
191
+
A full list of APIs are here: https://segment.com/docs/api/config-api/
192
192
193
193
The example below shows how you would get a users workspace if you had any of the above scopes:
194
194
@@ -254,7 +254,7 @@ If you created the app with the `destination/<slug>` scope, you can only access
254
254
255
255
### How do I create or update a destination that requires more configuration than just a API Key?
256
256
257
-
`GET` the destination settings using our catalog API first. This shows all of the fields the destination supports. You can then substitute the field values for the ones you need to specify.
257
+
`GET` the destination settings using Segment's catalog API first. This shows all of the fields the destination supports. You can then substitute the field values for the ones you need to specify.
258
258
259
259
Using this body, craft a `CREATE` request and substitute the appropriate field values. Check out https://reference.segmentapis.com/ > Destination > CREATE request for an example
260
260
@@ -280,19 +280,19 @@ Your `redirect_uri` probably doesn't match what you set in the App Create Reques
280
280
281
281
### How many redirect_uris can I have? Can I add more after the app is created?
282
282
283
-
You can have five `redirect_uris` on app creation. Editing the app info directly is not supported at this time. [contact us](https://segment.com/help/contact/) if you want any of your `redirect_uris` or other info changed.
283
+
You can have five `redirect_uris` on app creation. Editing the app info directly is not supported at this time. [contact Segment](https://segment.com/help/contact/) if you want any of your `redirect_uris` or other info changed.
284
284
285
285
In the future we will allow you to update this information on your own.
286
286
287
287
### I am getting "malformed token" when I try to access the API. What is wrong?
288
288
289
-
- Tokens expire every hour, so your token might have expired. To get a new access_token, hit the refresh endpoint. Make sure you pass in the correct `install_name`, `client_id` and `client_secret` in that request.
289
+
- Tokens expire every hour, so your token might have expired. To get a new access_token, hit the refresh endpoint. Make sure you pass in the correct `install_name`, `client_id`, and `client_secret` in that request.
290
290
291
291
- You might not have permissions for the action you're trying to take. You can only write to a resource when you have `workspace:read` permission. If you need write access, then create a new app with `workspace` permission and then re-install it.
292
292
293
293
### Do you send CSRF state back when you redirect?
294
294
295
-
Yes. If you set the `state=123` parameter in your initial request, we send it back to you.
295
+
Yes. If you set the `state=123` parameter in your initial request, Segment sends it back to you.
296
296
297
297
### Do we still have to send the redirect_uri in the oauth2/token request?
298
298
@@ -306,4 +306,4 @@ When the app was installed, you should have received a Segment `workspace` and
306
306
307
307
### OK I managed to create an App. How do I use your APIs?
0 commit comments