Skip to content

Commit ee5ba2e

Browse files
author
Niall Brennan
committed
Remove basic auth
1 parent 459d124 commit ee5ba2e

File tree

1 file changed

+18
-16
lines changed
  • src/connections/sources/catalog/libraries/server/http-api

1 file changed

+18
-16
lines changed

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ 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 requests.
15-
16-
#### Basic authentication
14+
Choose between [writeKey authentication](#writeKey-authentication) and [OAuth](#oauth) to authenticate requests.
1715

16+
#### writeKey authentication
1817
Authenticate to the Tracking API by sending your project's **Write Key** along with a request.
19-
Authentication uses HTTP Basic Auth, which involves a `username:password` that is base64 encoded and prepended with the string `Basic`.
20-
21-
In practice that means taking a Segment source **Write Key**,`'abc123'`, as the username, adding a colon, and then the password field is left empty. After base64 encoding `'abc123:'` becomes `'YWJjMTIzOg=='`; and this is passed in the authorization header like so: `'Authorization: Basic YWJjMTIzOg=='`.
22-
23-
> info ""
24-
> 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.
18+
The authentication writeKey should be snet as part of the body of the request. This will be encrypted over https.
2519

2620
#### OAuth
2721
[Obtain the access token](/docs/connections/oauth/) from the Authorization Server specific to the region.
@@ -105,7 +99,8 @@ POST https://api.segment.io/v1/identify
10599
"context": {
106100
"ip": "24.5.68.47"
107101
},
108-
"timestamp": "2012-12-02T00:30:08.276Z"
102+
"timestamp": "2012-12-02T00:30:08.276Z",
103+
"writeKey": "123xyz"
109104
}
110105
```
111106
This call is identifying the user by their unique User ID (the one you know them by in your database) and labeling them with `email`, `name`, and `industry` traits.
@@ -145,7 +140,8 @@ POST https://api.segment.io/v1/track
145140
"context": {
146141
"ip": "24.5.68.47"
147142
},
148-
"timestamp": "2012-12-02T00:30:12.984Z"
143+
"timestamp": "2012-12-02T00:30:12.984Z",
144+
"writeKey": "123xyz"
149145
}
150146
```
151147

@@ -178,7 +174,8 @@ POST https://api.segment.io/v1/page
178174
{
179175
"userId": "019mr8mf4r",
180176
"name": "Tracking HTTP API",
181-
"timestamp": "2012-12-02T00:31:29.738Z"
177+
"timestamp": "2012-12-02T00:31:29.738Z",
178+
"writeKey": "123xyz"
182179
}
183180
```
184181
The `page` call has the following fields:
@@ -210,7 +207,8 @@ POST https://api.segment.io/v1/screen
210207
{
211208
"userId": "019mr8mf4r",
212209
"name": "Tracking HTTP API",
213-
"timestamp": "2012-12-02T00:31:29.738Z"
210+
"timestamp": "2012-12-02T00:31:29.738Z",
211+
"writeKey": "123xyz"
214212
}
215213
```
216214

@@ -249,7 +247,8 @@ POST https://api.segment.io/v1/group
249247
"industry": "Technology",
250248
"employees": 420
251249
},
252-
"timestamp": "2012-12-02T00:31:38.208Z"
250+
"timestamp": "2012-12-02T00:31:38.208Z",
251+
"writeKey": "123xyz"
253252
}
254253
```
255254
The `group` call has the following fields:
@@ -282,7 +281,8 @@ POST https://api.segment.io/v1/alias
282281
{
283282
"previousId": "39239-239239-239239-23923",
284283
"userId": "019mr8mf4r",
285-
"timestamp": "2012-12-02T00:31:29.738Z"
284+
"timestamp": "2012-12-02T00:31:29.738Z",
285+
"writeKey": "123xyz"
286286
}
287287
```
288288
The `alias` call has the following fields:
@@ -365,6 +365,7 @@ POST https://api.segment.io/v1/batch
365365
"timestamp": "2015-2-02T00:30:12.984Z"
366366
}
367367
],
368+
"writeKey": "123xyz",
368369
"context": {
369370
"device": {
370371
"type": "phone",
@@ -422,7 +423,8 @@ POST https://api.segment.io/v1/identify
422423
"Mixpanel": true,
423424
"Kissmetrics": true,
424425
"Google Analytics": false
425-
}
426+
},
427+
"writeKey": "123xyz"
426428
}
427429
```
428430

0 commit comments

Comments
 (0)