Skip to content

Commit 7d3dba4

Browse files
authored
fix: remove @octokit/auth-basic (#134)
BREAKING CHANGE: `createBasicAuth()` is no longer exported. Basic Auth support for GitHubs API has been removed. You can find the legacy authentication strategy at https://github.com/octokit/auth-basic.js
1 parent 0009cf4 commit 7d3dba4

File tree

5 files changed

+963
-686
lines changed

5 files changed

+963
-686
lines changed

README.md

Lines changed: 5 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ GitHub supports 4 authentication strategies. They are all implemented in `@octok
1313
- [Official Strategies](#official-strategies)
1414
- [Comparison](#comparison)
1515
- [Token authentication](#token-authentication)
16-
- [Basic and personal access token authentication](#basic-and-personal-access-token-authentication)
1716
- [GitHub App or installation authentication](#github-app-or-installation-authentication)
1817
- [OAuth app and OAuth access token authentication](#oauth-app-and-oauth-access-token-authentication)
1918
- [GitHub Action authentication](#github-action-authentication)
@@ -36,7 +35,6 @@ Load `@octokit/auth` directly from [cdn.skypack.dev](https://cdn.skypack.dev)
3635
```html
3736
<script type="module">
3837
import {
39-
createBasicAuth,
4038
createAppAuth,
4139
createOAuthAppAuth,
4240
createTokenAuth,
@@ -53,15 +51,13 @@ Install with <code>npm install @octokit/auth</code>
5351

5452
```js
5553
const {
56-
createBasicAuth,
5754
createAppAuth,
5855
createOAuthAppAuth,
5956
createTokenAuth,
6057
createActionAuth,
6158
} = require("@octokit/auth");
6259
// or:
6360
// import {
64-
// createBasicAuth,
6561
// createAppAuth,
6662
// createOAuthAppAuth,
6763
// createTokenAuth,
@@ -74,12 +70,9 @@ const {
7470
</table>
7571

7672
```js
77-
const auth = createBasicAuth({
78-
username: "monatheoctocat",
79-
password: "secret",
80-
on2Fa() {
81-
return prompt("Two-factor authentication Code:");
82-
},
73+
const auth = createAppAuth({
74+
appId: 12345,
75+
privateKey: "...",
8376
});
8477
```
8578

@@ -88,7 +81,7 @@ Each function exported by `@octokit/auth` returns an async `auth` function.
8881
The `auth` function resolves with an authentication object. If multiple authentication types are supported, a `type` parameter can be passed.
8982

9083
```js
91-
const { token } = await auth({ type: "token" });
84+
const { token } = await auth({ type: "app" });
9285
```
9386

9487
Additionally, `auth.hook()` can be used to directly hook into [`@octokit/request`](https://github.com/octokit/request.js#readme). If multiple authentication types are supported, the right authentication type will be applied automatically based on the request URL.
@@ -145,71 +138,6 @@ token
145138
</td></tr>
146139
<tr><td>
147140

148-
`@octokit/auth-basic`
149-
150-
</td><td>
151-
152-
```
153-
{
154-
username*,
155-
password*,
156-
on2Fa*,
157-
token,
158-
request
159-
}
160-
```
161-
162-
</td><td>
163-
164-
```
165-
{
166-
type*, // "basic" or "token"
167-
refresh
168-
}
169-
```
170-
171-
</td><td>
172-
173-
```
174-
{
175-
type: "basic"
176-
username: "octocat",
177-
password: "secret",
178-
credentials: "b2N0b2NhdDpzZWNyZXQ=",
179-
totp: "123456"
180-
}
181-
```
182-
183-
</td><td>
184-
185-
```
186-
{
187-
type: "token"
188-
tokenType: "pat",
189-
token: "secret123",
190-
id: 123,
191-
username: "octocat",
192-
scopes: []
193-
}
194-
```
195-
196-
</td><td>
197-
198-
```
199-
{
200-
type: "token"
201-
tokenType: "oauth",
202-
token: "secret123",
203-
id: 123,
204-
appClientId: "abc123",
205-
username: "octocat",
206-
scopes: []
207-
}
208-
```
209-
210-
</td></tr>
211-
<tr><td>
212-
213141
`@octokit/auth-app`
214142

215143
</td><td>
@@ -358,35 +286,13 @@ const { token, tokenType } = await auth();
358286

359287
See [@octokit/auth-token](https://github.com/octokit/auth-token.js#readme) for more details.
360288

361-
### Basic and personal access token authentication
362-
363-
Example
364-
365-
```js
366-
const auth = createBasicAuth({
367-
username: "octocat",
368-
password: "secret",
369-
async on2Fa() {
370-
// prompt user for the one-time password retrieved via SMS or authenticator app
371-
return prompt("Two-factor authentication Code:");
372-
},
373-
});
374-
375-
const { token } = await auth();
376-
const { totp } = await auth({
377-
type: "basic",
378-
});
379-
```
380-
381-
See [`@octokit/auth-basic`](https://github.com/octokit/auth-basic.js#readme) for more details.
382-
383289
### GitHub App or installation authentication
384290

385291
Example
386292

387293
```js
388294
const auth = createAppAuth({
389-
id: 1,
295+
appId: 1,
390296
privateKey: "-----BEGIN RSA PRIVATE KEY-----\n...",
391297
});
392298

0 commit comments

Comments
 (0)