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
// or: import { createAppAuth } from "@octokit/auth-app";
72
+
import { createAppAuth } from"@octokit/auth-app";
74
73
```
75
74
76
75
</td></tr>
77
76
</tbody>
78
77
</table>
79
78
79
+
> [!IMPORTANT]
80
+
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `"moduleResolution": "node16", "module": "node16"`.
81
+
>
82
+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
83
+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
84
+
80
85
### Authenticate as GitHub App (JSON Web Token)
81
86
82
87
```js
@@ -225,8 +230,8 @@ Node
225
230
Install with `npm install @octokit/core @octokit/auth-app`. Optionally replace `@octokit/core` with a compatible module
<strong>Required</strong>. Content of the <code>*.pem</code> file you downloaded from the app’s about page. You can generate a new private key if needed.
340
+
<strong>Required</strong>. Content of the <code>*.pem</code> file you downloaded from the app’s about page. You can generate a new private key if needed. If your private key contains escaped newlines (`\\n`), they will be automatically replaced with actual newlines.
336
341
</td>
337
342
</tr>
338
343
<tr>
@@ -382,7 +387,7 @@ Automatically set to `octokit.request` when using with an `Octokit` constructor.
382
387
For standalone usage, you can pass in your own [`@octokit/request`](https://github.com/octokit/request.js) instance. For usage with enterprise, set `baseUrl` to the hostname + `/api/v3`. Example:
383
388
384
389
```js
385
-
const { request } =require("@octokit/request");
390
+
import { request } from"@octokit/request";
386
391
createAppAuth({
387
392
appId:1,
388
393
privateKey:"-----BEGIN PRIVATE KEY-----\n...",
@@ -431,10 +436,11 @@ createAppAuth({
431
436
You can pass in your preferred logging tool by passing <code>option.log</code> to the constructor. If you would like to make the log level configurable using an environment variable or external option, we recommend the console-log-level package. For example:
@@ -674,10 +680,7 @@ The `auth({type: "oauth-user", factory })` call with resolve with whatever the f
674
680
For example, you can create a new `auth` instance for an installation which shares the internal state (especially the access token cache) with the calling `auth` instance:
@@ -807,10 +810,7 @@ The `auth({type: "oauth-user", factory })` call with resolve with whatever the f
807
810
For example, you can create a new `auth` instance for an installation which shares the internal state (especially the access token cache) with the calling `auth` instance:
`After 3 retries within 6s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`,
1911
1925
);
1912
1926
});
1913
1927
1914
1928
// it takes 3 retries until a total time of more than 5s pass
1915
-
awaitclock.tickAsync(1000);
1916
-
awaitclock.tickAsync(2000);
1917
-
awaitclock.tickAsync(3000);
1929
+
// Note sure why the first advance is needed, but it helped unblock https://github.com/octokit/auth-app.js/pull/580
1930
+
awaitjest.advanceTimersByTimeAsync(100);
1931
+
awaitjest.advanceTimersByTimeAsync(1000);
1932
+
awaitjest.advanceTimersByTimeAsync(2000);
1933
+
awaitjest.advanceTimersByTimeAsync(3000);
1934
+
awaitjest.runAllTimersAsync();
1935
+
1936
+
awaitpromise;
1918
1937
});
1919
1938
1920
1939
test("auth.hook(): throws on 500 error without retries",async()=>{
0 commit comments