@@ -101,6 +101,259 @@ const requestWithAuth = request.defaults({
101101const { data: authorizations } = await requestWithAuth (" GET /authorizations" );
102102```
103103
104+ ## Comparison
105+
106+ <table >
107+ <thead align =left valign =top >
108+ <tr>
109+ <th>Module</th>
110+ <th>Strategy Options</th>
111+ <th>Auth Options</th>
112+ <th colspan=3>Authentication objects</th>
113+ </tr>
114+ </thead >
115+ <tbody align =left valign =top ><tr ><td >
116+
117+ ` @octokit/auth-token `
118+
119+ </td ><td >
120+
121+ ```
122+ token
123+ ```
124+
125+ </td ><td >
126+
127+ ```
128+ -
129+ ```
130+
131+ </td ><td colspan =3 >
132+
133+ ```
134+ {
135+ type: "token",
136+ token: "secret123",
137+ tokenType, "oauth" // or "installation"
138+ }
139+ ```
140+
141+ </td ></tr >
142+ <tr ><td >
143+
144+ ` @octokit/auth-basic `
145+
146+ </td ><td >
147+
148+ ```
149+ {
150+ username*,
151+ password*,
152+ on2Fa*,
153+ token,
154+ request
155+ }
156+ ```
157+
158+ </td ><td >
159+
160+ ```
161+ {
162+ type*, // "basic" or "token"
163+ refresh
164+ }
165+ ```
166+
167+ </td ><td >
168+
169+ ```
170+ {
171+ type: "basic"
172+ username: "octocat",
173+ password: "secret",
174+ credentials: "b2N0b2NhdDpzZWNyZXQ=",
175+ totp: "123456"
176+ }
177+ ```
178+
179+ </td ><td >
180+
181+ ```
182+ {
183+ type: "token"
184+ tokenType: "pat",
185+ token: "secret123",
186+ id: 123,
187+ username: "octocat",
188+ scopes: []
189+ }
190+ ```
191+
192+ </td ><td >
193+
194+ ```
195+ {
196+ type: "token"
197+ tokenType: "oauth",
198+ token: "secret123",
199+ id: 123,
200+ appClientId: "abc123",
201+ username: "octocat",
202+ scopes: []
203+ }
204+ ```
205+
206+ </td ></tr >
207+ <tr ><td >
208+
209+ ` @octokit/auth-app `
210+
211+ </td ><td >
212+
213+ ```
214+ {
215+ id*,
216+ privateKey*,
217+ installationId,
218+ cache,
219+ request
220+ }
221+ ```
222+
223+ </td ><td >
224+
225+ ```
226+ {
227+ type*, // "app" or "installation"
228+ installationId,
229+ repositoryIds,
230+ permissions,
231+ refresh
232+ }
233+ ```
234+
235+ </td ><td >
236+
237+ ```
238+ {
239+ type: "app",
240+ token: "abc.def.1234",
241+ appId: 123,
242+ expriseAt: "2019-06-11T22:22:34Z"
243+ }
244+ ```
245+
246+ </td ><td colspan =2 >
247+
248+ ```
249+ {
250+ type: "token",
251+ tokenType: "installation",
252+ token: "v1.secret123",
253+ installationId: 1234,
254+ expriseAt: "2019-06-11T22:22:34Z",
255+ repositoryIds: [12345],
256+ permissions: {
257+ single_file: 'write'
258+ },
259+ singleFileName: '.github/myapp.yml'
260+ }
261+ ```
262+
263+ </td ></tr >
264+ <tr ><td >
265+
266+ ` @octokit/auth-oauth-app `
267+
268+ </td ><td >
269+
270+ ```
271+ {
272+ clientId*,
273+ clientSecret*,
274+ code,
275+ redirectUrl,
276+ state,
277+ request
278+ }
279+ ```
280+
281+ </td ><td >
282+
283+ ```
284+ {
285+ type*, // "oauth-app" or "token"
286+ url
287+ }
288+ ```
289+
290+ </td ><td >
291+
292+ ```
293+ {
294+ type: "oauth-app",
295+ clientId: "abc123",
296+ clientSecret: "abc123secret",
297+ headers: {},
298+ query: {
299+ clientId: "abc123",
300+ clientSecret: "abc123secret"
301+ }
302+ }
303+ ```
304+
305+ </td ><td colspan =2 >
306+
307+ ```
308+ {
309+ type: "token",
310+ tokenType: "oauth",
311+ token: "123secret",
312+ scopes: []
313+ }
314+ ```
315+
316+ </td ></tr >
317+ <tr ><td >
318+
319+ ` @octokit/auth-action `
320+
321+ </td ><td >
322+
323+ ```
324+ -
325+ ```
326+
327+ </td ><td >
328+
329+ ```
330+ -
331+ ```
332+
333+ </td ><td colspan =3 >
334+
335+ ```
336+ {
337+ type: "token",
338+ tokenType: "installation",
339+ token: "v1.123secret"
340+ }
341+ ```
342+
343+ </td ></tr ></tbody >
344+ </table >
345+
346+ ## Token authentication
347+
348+ Example
349+
350+ ``` js
351+ const auth = createTokenAuth (" 1234567890abcdef1234567890abcdef12345678" );
352+ const { token , tokenType } = await auth ();
353+ ```
354+
355+ See [ @octokit/auth-token ] ( https://github.com/octokit/auth-token.js#readme ) for more details.
356+
104357## Basic and personal access token authentication
105358
106359Example
@@ -162,17 +415,6 @@ const tokenAuthentication = await auth({ type: "token" });
162415
163416See [ @octokit/auth-oauth-app ] ( https://github.com/octokit/auth-oauth-app.js#readme ) for more details.
164417
165- ## Token authentication
166-
167- Example
168-
169- ``` js
170- const auth = createTokenAuth (" 1234567890abcdef1234567890abcdef12345678" );
171- const { token , tokenType } = await auth ();
172- ```
173-
174- See [ @octokit/auth-token ] ( https://github.com/octokit/auth-token.js#readme ) for more details.
175-
176418## GitHub Action authentication
177419
178420Example
0 commit comments