Skip to content

Commit 50cdf61

Browse files
committed
edits [netlify-build]
1 parent 4b33a54 commit 50cdf61

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

src/connections/oauth.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ To disable your source from OAuth, turn the toggle off for **Enable OAuth**.
7171
You can obtain an access token once you create an OAuth application and enable a source to OAuth.
7272

7373
Access tokens are only valid within a region. The supported regional authorization servers are:
74-
* Oregon - https://oauth2.segment.io
75-
* Dublin - https://oauth2.eu1.segmentapis.com
74+
* Oregon - `https://oauth2.segment.io`
75+
* Dublin - `https://oauth2.eu1.segmentapis.com`
7676

7777
To obtain the access token:
7878

@@ -108,7 +108,7 @@ To obtain the access token:
108108
EXP | The expiry time in seconds. This is expected to be valid only for a short duration under a minute.
109109
JTI | The unique identifer for the token.
110110
111-
2. Send a form-url-encoded POST request to the regional authorization server with the following parameters:
111+
2. Send a form-url-encoded `POST` request to the regional authorization server with the following parameters:
112112
113113
```
114114
grant_type=client_credentials
@@ -122,27 +122,7 @@ To obtain the access token:
122122
JWT | The signed JWT token string from Step 1.
123123
SCOPE | Scopes for which token is requested. See [supported scopes](#supported-scopes).
124124
125-
3. Include the access token in the Authorization header as a Bearer token. For example:
126-
127-
```
128-
Authorization: Bearer <access token>
129-
```
130-
131-
Below is an example cURL request:
132-
133-
```
134-
curl --location 'https://api.segment.io/v1/track' \
135-
--header 'Content-Type: application/json' \
136-
--header 'Authorization: Bearer <access token>' \
137-
--data-raw '{
138-
"event": "happy-path-a3ef8a6f-0482-4694-bc4d-4afba03a0eab",
139-
"email": "[email protected]",
140-
"messageId": "58524f3a-3b76-4eac-aa97-d88bccdf4f77",
141-
"userId": "123",
142-
"writeKey": "DmBXIN4JnwqBnTqXccTF0wBnLXNQmFtk"
143-
}
144-
```
145-
125+
To use the access token, see an example of how to use the access token in the [HTTP API source]().
146126
147127
## Edit an OAuth application
148128
To edit an existing OAuth application:

src/connections/sources/catalog/libraries/server/http-api/index.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Segment has native [sources](/docs/connections/sources/) for most use cases (lik
1111

1212
### Authentication
1313

14+
Choose between [basic authentication](#basic-authentication) and [OAuth](#oauth) to authenticate headers.
15+
16+
#### Basic authentication
17+
1418
Authenticate to the Tracking API by sending your project's **Write Key** along with a request.
1519
Authentication uses HTTP Basic Auth, which involves a `username:password` that is base64 encoded and prepended with the string `Basic`.
1620

@@ -19,6 +23,33 @@ In practice that means taking a Segment source **Write Key**,`'abc123'`, as the
1923
> info ""
2024
> Include a colon before encoding. While encoding the write key without a colon might work due to backward compatibility, this won't always be the case.
2125
26+
#### OAuth
27+
[Obtain the access token](/docs/connections/oauth/) from the Authorization Server specific to the region.
28+
29+
Include the access token in the Authorization header as a Bearer token to the resource server. For example:
30+
31+
```
32+
Authorization: Bearer <access token>
33+
```
34+
35+
36+
For example, to use the access token in the HTTP API Source, use `access_token` in the header and `write_key` in the payload. An example cURL request looks like:
37+
38+
```
39+
curl --location 'https://api.segment.io/v1/track' \
40+
--header 'Content-Type: application/json' \
41+
--header 'Authorization: Bearer <access token>' \
42+
--data-raw '{
43+
"event": "happy-path-a3ef8a6f-0482-4694-bc4d-4afba03a0eab",
44+
"email": "[email protected]",
45+
"messageId": "58524f3a-3b76-4eac-aa97-d88bccdf4f77",
46+
"userId": "123",
47+
"writeKey": "DmBXIN4JnwqBnTqXccTF0wBnLXNQmFtk"
48+
}
49+
```
50+
51+
You can reuse the access token until the expiry period specified on the OAuth application.
52+
2253
### Content-Type
2354

2455
To send data to Segment's HTTP API, a content-type header must be set to `'application/json'`.

0 commit comments

Comments
 (0)