oauth2-cli 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/Session.d.ts +1 -1
- package/dist/Session.js +21 -7
- package/dist/WebServer.d.ts +10 -1
- package/dist/WebServer.js +6 -2
- package/package.json +1 -1
- package/views/error.ejs +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.8.3](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.8.2...oauth2-cli/0.8.3) (2026-02-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* continued server timeout improvements ([2e8d275](https://github.com/battis/oauth2-cli/commit/2e8d275706be411b317e2257bd97ee8f7fe4bc95))
|
|
11
|
+
|
|
5
12
|
## [0.8.2](https://github.com/battis/oauth2-cli/compare/oauth2-cli/0.8.1...oauth2-cli/0.8.2) (2026-02-18)
|
|
6
13
|
|
|
7
14
|
|
package/dist/Session.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class Session {
|
|
|
28
28
|
* {@link authorizationCodeGrant}
|
|
29
29
|
*/
|
|
30
30
|
get resolve(): SessionResolver;
|
|
31
|
-
reject(
|
|
31
|
+
reject(cause: unknown): void;
|
|
32
32
|
constructor({ client, views, inject: request }: SessionOptions);
|
|
33
33
|
/** Instantiate the web server that will listen for the out-of-band redirect */
|
|
34
34
|
protected instantiateWebServer(options: Omit<WebServer.WebServerOptions, 'session'>): WebServer.WebServerInterface;
|
package/dist/Session.js
CHANGED
|
@@ -20,12 +20,12 @@ export class Session {
|
|
|
20
20
|
*/
|
|
21
21
|
get resolve() {
|
|
22
22
|
if (!this._resolve) {
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error(`Session resolve method is ${this._resolve}`);
|
|
24
24
|
}
|
|
25
25
|
return this._resolve;
|
|
26
26
|
}
|
|
27
|
-
reject(
|
|
28
|
-
throw
|
|
27
|
+
reject(cause) {
|
|
28
|
+
throw new Error('Session failed', { cause });
|
|
29
29
|
}
|
|
30
30
|
constructor({ client, views, inject: request }) {
|
|
31
31
|
this.spinner = ora('Awaiting interactive authorization').start();
|
|
@@ -58,12 +58,26 @@ export class Session {
|
|
|
58
58
|
if (!closed) {
|
|
59
59
|
this.spinner.text =
|
|
60
60
|
'Still waiting for out-of-band redirect server to shut down.\n' +
|
|
61
|
-
' Your browser may be holding the connection to the server open.\n' +
|
|
62
|
-
' Please close the "Authorization Complete" tab in your browser
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
' Your browser may be holding the connection to the server open.\n\n' +
|
|
62
|
+
' Please close the "Authorization Complete" tab in your browser.';
|
|
63
|
+
}
|
|
64
|
+
}, 5000);
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
if (!closed) {
|
|
67
|
+
this.spinner.text =
|
|
68
|
+
'Still waiting for out-of-band redirect server to shut down.\n' +
|
|
69
|
+
' Your browser may be holding the connection to the server open.\n\n' +
|
|
70
|
+
' Please close the browser window.';
|
|
65
71
|
}
|
|
66
72
|
}, 10000);
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
if (!closed) {
|
|
75
|
+
this.spinner.text =
|
|
76
|
+
'Still waiting for out-of-band redirect server to shut down.\n' +
|
|
77
|
+
' Your browser may be holding the connection to the server open.\n\n' +
|
|
78
|
+
' Please quit the browser.';
|
|
79
|
+
}
|
|
80
|
+
}, 15000);
|
|
67
81
|
};
|
|
68
82
|
const url = gcrtl
|
|
69
83
|
.expand(this.outOfBandRedirectServer.authorization_endpoint, this.client.redirect_uri)
|
package/dist/WebServer.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export type WebServerOptions = {
|
|
|
15
15
|
* URL, the first step in the Authorization Code Grant flow.
|
|
16
16
|
*/
|
|
17
17
|
authorize_endpoint?: PathString;
|
|
18
|
+
/**
|
|
19
|
+
* The number of milliseconds of inactivity before a socket is presumed to
|
|
20
|
+
* have timed out. This can be reduced to limit potential wait times during
|
|
21
|
+
* interactive authentication, but must still be long enough to allow time for
|
|
22
|
+
* the authorization code to be exchanged for an access token.
|
|
23
|
+
*
|
|
24
|
+
* Defaults to 1000 milliseconds
|
|
25
|
+
*/
|
|
26
|
+
timeout?: number;
|
|
18
27
|
};
|
|
19
28
|
export declare const DEFAULT_AUTHORIZE_ENDPOINT = "/oauth2-cli/authorize";
|
|
20
29
|
export interface WebServerInterface {
|
|
@@ -35,7 +44,7 @@ export declare class WebServer implements WebServerInterface {
|
|
|
35
44
|
protected readonly port: string;
|
|
36
45
|
readonly authorization_endpoint: PathString;
|
|
37
46
|
private server;
|
|
38
|
-
constructor({ session, views, authorize_endpoint }: WebServerOptions);
|
|
47
|
+
constructor({ session, views, authorize_endpoint, timeout }: WebServerOptions);
|
|
39
48
|
/**
|
|
40
49
|
* Set the path to folder of *.ejs templates
|
|
41
50
|
*
|
package/dist/WebServer.js
CHANGED
|
@@ -23,7 +23,8 @@ export class WebServer {
|
|
|
23
23
|
port;
|
|
24
24
|
authorization_endpoint;
|
|
25
25
|
server;
|
|
26
|
-
constructor({ session, views, authorize_endpoint = DEFAULT_AUTHORIZE_ENDPOINT
|
|
26
|
+
constructor({ session, views, authorize_endpoint = DEFAULT_AUTHORIZE_ENDPOINT, timeout = 1000 // milliseconds
|
|
27
|
+
}) {
|
|
27
28
|
this.session = session;
|
|
28
29
|
this.authorization_endpoint = authorize_endpoint;
|
|
29
30
|
this.views = views;
|
|
@@ -37,6 +38,9 @@ export class WebServer {
|
|
|
37
38
|
app.get(this.authorization_endpoint, this.handleAuthorizationEndpoint.bind(this));
|
|
38
39
|
app.get(gcrtl.path(url), this.handleRedirect.bind(this));
|
|
39
40
|
this.server = app.listen(gcrtl.port(url));
|
|
41
|
+
this.server.timeout = timeout;
|
|
42
|
+
this.server.keepAliveTimeout = 0;
|
|
43
|
+
this.server.keepAliveTimeoutBuffer = 0;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* Set the path to folder of *.ejs templates
|
|
@@ -87,7 +91,7 @@ export class WebServer {
|
|
|
87
91
|
try {
|
|
88
92
|
await this.session.handleAuthorizationCodeRedirect(req);
|
|
89
93
|
if (!(await this.render(res, 'complete.ejs'))) {
|
|
90
|
-
res.send('You may close this window.');
|
|
94
|
+
res.send('Authorization complete. You may close this window.');
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
catch (error) {
|
package/package.json
CHANGED
package/views/error.ejs
CHANGED
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
<div class="center container">
|
|
33
33
|
<h1>Authorization Error</h1>
|
|
34
34
|
<div class="alert alert-danger" role="alert">
|
|
35
|
-
|
|
36
|
-
<pre><%= JSON.stringify(error,null,2) %></pre>
|
|
37
|
-
<% } %>
|
|
35
|
+
<pre><%= JSON.stringify(error, null, 2) %></pre>
|
|
38
36
|
</div>
|
|
39
37
|
<p>You may close this window.</p>
|
|
40
38
|
</div>
|